package com.ymatou.iapi.trading.operate.testcase;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.zip.GZIPInputStream;

import org.apache.commons.collections.CollectionUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.proditem.service.GetProductInfoByProductIdCall;
import com.ymatou.iapi.productprice.parameter.CatalogAllPriceBean;
import com.ymatou.iapi.productprice.parameter.ProductAllPriceBean;
import com.ymatou.iapi.trading.operate.parameter.ActivityVo;
import com.ymatou.iapi.trading.operate.parameter.OrderGroupVo;
import com.ymatou.iapi.trading.operate.parameter.OrderItemVo;
import com.ymatou.iapi.trading.operate.parameter.OrderVo;
import com.ymatou.iapi.trading.operate.parameter.PlaceOrderService;
import com.ymatou.iapi.trading.operate.parameter.SellerCouponVo;
import com.ymatou.iapi.trading.operate.parameter.SellerPromotionVo;
import com.ymatou.iapi.trading.operate.parameter.YmatouCouponVo;
import com.ymatou.iapi.trading.operate.parameter.enums.ActivityPromotionTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.AppTerminalSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.BizTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.LogisticsTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.OrderSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.OrderTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.PriceTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.ProductRefundChannelEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.PromotionTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.SalesTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.SellerCouponApplianceTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.TerminalSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.YmatouCouponApplianceTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.po.OrderInfoSubPo;
import com.ymatou.iapi.trading.operate.parameter.po.ReturnStockCatalogInfoVo;
import com.ymatou.iapi.trading.operate.parameter.po.SubcatalogsPo;
import com.ymatou.iapi.trading.operate.parameter.po.TradingReqPo;
import com.ymatou.iapi.trading.operate.parameter.req.BizVo;
import com.ymatou.iapi.trading.operate.parameter.req.CatalogApportionVo;
import com.ymatou.iapi.trading.operate.parameter.req.PlaceOrderReq;
import com.ymatou.iapi.trading.operate.parameter.req.SellerPromotionApportionVo;
import com.ymatou.iapi.trading.operate.service.PlaceOrderCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.business.service.CouponCallService;
import com.ymttest.business.service.OrderCallService;
import com.ymttest.business.service.ProductCallService;
import com.ymttest.business.service.ProductPriceCallService;
import com.ymttest.business.service.SellerProductCallService;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.model.Userinfoex;
import com.ymttest.database.model.YmtCouponPrivateUserBound;
import com.ymttest.database.sqlwapper.DefaultWapper;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.database.sqlwapper.YmtCouponPrivateUserBoundWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.ECode;

/*
 * / 创建订单(新)接口 FreeMaker Template自动生成代码 /
 */
@TestSuite
public class Ts_PlaceOrder {
	private static PlaceOrderReq placeorderBean;

	private static PlaceOrderCall placeorderCall;

	private static DefaultWapper database = new DefaultWapper();

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("创建订单(新)接口");
	}

	@Before
	public void caseUp() {
		placeorderBean = new PlaceOrderReq();
		placeorderCall = new PlaceOrderCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(placeorderCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private boolean isSellercouponApplicable(SellerCouponVo coupon,
			String productId) {
		switch (coupon.getApplianceType()) {
			case ALL :
				return true;
			case SPEC_RODUCT :
				return coupon.getApplianceTargets().contains(productId);
			default :
				throw new IllegalArgumentException("未知的商户优惠券适用类型:"
						+ coupon.getApplianceType());
		}
	}

	/**
	 * 根据权重平摊一个数额
	 * 分摊规则  全部舍掉
	 * @param total
	 * @param weights
	 * @return
	 */
	public static BigDecimal[] apportionByWeights(BigDecimal total,
			BigDecimal[] weights) {

		assert total.compareTo(BigDecimal.ZERO) >= 0 && weights != null
				&& weights.length > 0;

		if (total.compareTo(BigDecimal.ZERO) == 0) {

			BigDecimal[] result = new BigDecimal[weights.length];

			Arrays.fill(result, BigDecimal.ZERO);

			return result;
		}

		BigDecimal totalWeight = BigDecimal.ZERO;

		for (BigDecimal weight : weights) {
			totalWeight = totalWeight.add(weight);
		}

		BigDecimal[] result = new BigDecimal[weights.length];

		BigDecimal sum = BigDecimal.ZERO;

		int lastNotZeroIndex = -1;
		for (int i = 0; i < weights.length - 1; i++) {

			// MathContext.DECIMAL32 参数用于防止无限循环小数导致的异常
			result[i] = weights[i].divide(totalWeight, MathContext.DECIMAL32)
					.multiply(total)
					// 小数点后2位的直接舍去
					.setScale(2, RoundingMode.DOWN);
			sum = sum.add(result[i]);
			if (weights[i].compareTo(BigDecimal.ZERO) > 0) {
				lastNotZeroIndex = i;
			}
		}
		if (weights[weights.length - 1].compareTo(BigDecimal.ZERO) == 0) {
			result[lastNotZeroIndex] = result[lastNotZeroIndex].add(total
					.subtract(sum));
			result[weights.length - 1] = BigDecimal.ZERO;
		} else {
			result[weights.length - 1] = total.subtract(sum);
		}
		return result;
	}

	/**
	 * 根据权重平摊一个数额
	 * 
	 * 分摊规则 4舍5入
	 * 
	 * @param total
	 * @param weights
	 * @return
	 */
	public static BigDecimal[] apportionByWeights2(BigDecimal total,
			BigDecimal[] weights) {

		assert total.compareTo(BigDecimal.ZERO) >= 0 && weights != null
				&& weights.length > 0;

		if (total.compareTo(BigDecimal.ZERO) == 0) {
			BigDecimal[] result = new BigDecimal[weights.length];
			Arrays.fill(result, BigDecimal.ZERO);
			return result;
		}

		BigDecimal totalWeight = BigDecimal.ZERO;

		for (BigDecimal weight : weights) {
			totalWeight = totalWeight.add(weight);
		}

		BigDecimal[] result = new BigDecimal[weights.length];

		BigDecimal sum = BigDecimal.ZERO;

		int lastNotZeroIndex = -1;
		for (int i = 0; i < weights.length - 1; i++) {

			// MathContext.DECIMAL32 参数用于防止无限循环小数导致的异常
			result[i] = weights[i].divide(totalWeight, MathContext.DECIMAL32)
					.multiply(total)
					// 小数点后2位的直接舍去
					.setScale(2, BigDecimal.ROUND_HALF_DOWN);
			sum = sum.add(result[i]);
			if (weights[i].compareTo(BigDecimal.ZERO) > 0) {
				lastNotZeroIndex = i;
			}
		}
		if (weights[weights.length - 1].compareTo(BigDecimal.ZERO) == 0) {
			result[lastNotZeroIndex] = result[lastNotZeroIndex].add(total
					.subtract(sum));
			result[weights.length - 1] = BigDecimal.ZERO;
		} else {
			result[weights.length - 1] = total.subtract(sum);
		}
		return result;
	}

	public static byte[] extractByGzip(byte[] data) {
		int count;
		GZIPInputStream gis = null;
		ByteArrayOutputStream os = new ByteArrayOutputStream();
		try {
			ByteArrayInputStream is = new ByteArrayInputStream(data);
			gis = new GZIPInputStream(is);
			byte[] temp = new byte[1024];
			while ((count = gis.read(temp, 0, 1024)) != -1) {
				os.write(temp, 0, count);
			}
		} catch (IOException e) {

			return null;
		} finally {
			try {
				if (gis != null) {
					gis.close();
				}
			} catch (IOException e) {

			}
		}
		return os.toByteArray();
	}

	public static String extractToString(byte[] data) {
		try {
			byte[] bytes = extractByGzip(data);
			if (bytes != null) {
				return new String(bytes, "UTF-8");
			}
		} catch (UnsupportedEncodingException e) {

		}
		return null;
	}

	private boolean isYmtcouponApplicable(String productId) {
		switch (placeorderBean.getYmatouCoupon().getApplianceType()) {
			case ALL :
				return true;
			case SPEC_RODUCT :
				return placeorderBean.getYmatouCoupon().getApplianceTargets()
						.contains(productId);
			default :
				throw new IllegalArgumentException("未知的平台优惠券适用类型:"
						+ placeorderBean.getYmatouCoupon().getApplianceType());
		}
	}

	private void verifyDb() {
		try {

			JSONArray orderIds = placeorderCall.getOrderIds();

			if (orderIds.length() > 0) {
				// ymt_tradinginfo 表
				int tradingId = placeorderCall.getTradingId();
				// 共多少个买手
				int sellerCount = placeorderBean.getOrderGroups().size();
				// 所有商品总的成交价
				BigDecimal sumOrdersPrice = BigDecimal.ZERO;
				List<OrderVo> orderList = new ArrayList<OrderVo>();
				// 各订单分摊平台优惠券的权重
				List<BigDecimal> orderWeightsOnYmatouCouponList = new ArrayList<BigDecimal>();
				for (OrderGroupVo group : placeorderBean.getOrderGroups()) {
					List<BigDecimal> orderWeightsOnSellerCouponList = new ArrayList<BigDecimal>();
					for (OrderVo order : group.getOrders()) {
						orderList.add(order);
						// 当前订单关于运费分配的权重
						List<BigDecimal> orderItemWeightsOnFreight = new ArrayList<BigDecimal>();
						// 当前订单关于商家券分配的权重
						List<BigDecimal> orderItemWeightsOnSellerCoupon = new ArrayList<BigDecimal>();
						// 当前订单关于平台券分配的权重
						List<BigDecimal> orderItemWeightsOnYmatouCoupon = new ArrayList<BigDecimal>();

						// 当前订单下所有商品总定金价格
						BigDecimal totalEarnestPrice = BigDecimal.ZERO;
						// 当前订单下所有商品总原价
						BigDecimal totalOriginalPrice = BigDecimal.ZERO;
						// 当前订单下所有商品总成交价
						BigDecimal totalProductPrice = BigDecimal.ZERO;
						// 当前订单下能使用平台券的总金额
						BigDecimal orderWeightOnYmtCoupon = BigDecimal.ZERO;
						// 当前订单下能使用商家券的总金额
						BigDecimal orderWeightOnSellerCoupon = BigDecimal.ZERO;

						for (OrderItemVo item : order.getOrderItems()) {
							totalEarnestPrice = item
									.getEarnestPrice()
									.multiply(
											new BigDecimal(item.getProductNum()))
									.add(totalEarnestPrice);
							totalOriginalPrice = item
									.getOriginalPrice()
									.multiply(
											new BigDecimal(item.getProductNum()))
									.add(totalOriginalPrice);
							totalProductPrice = item
									.getProductPrice()
									.multiply(
											new BigDecimal(item.getProductNum()))
									.add(totalProductPrice);
							orderItemWeightsOnFreight
									.add(item.getProductPrice()
											.multiply(
													new BigDecimal(item
															.getProductNum())));

							if (placeorderBean.getYmatouCoupon() != null) {
								// 平台优惠券适用的指定商品
								if (isYmtcouponApplicable(item.getProductId())) {
									// 商品能用平台券
									orderItemWeightsOnYmatouCoupon.add(item
											.getProductPrice().multiply(
													new BigDecimal(item
															.getProductNum())));
									orderWeightOnYmtCoupon = orderWeightOnYmtCoupon
											.add(item
													.getProductPrice()
													.multiply(
															new BigDecimal(
																	item.getProductNum())));
								} else {
									orderItemWeightsOnYmatouCoupon
											.add(BigDecimal.ZERO);
									orderWeightOnYmtCoupon = orderWeightOnYmtCoupon
											.add(BigDecimal.ZERO);
								}
							}

							if (group.getSellerCoupon() != null) {
								// 商家优惠券适用的指定商品
								if (isSellercouponApplicable(
										group.getSellerCoupon(),
										item.getProductId())) {
									orderItemWeightsOnSellerCoupon.add(item
											.getProductPrice().multiply(
													new BigDecimal(item
															.getProductNum())));
									orderWeightOnSellerCoupon = orderWeightOnSellerCoupon
											.add(item
													.getProductPrice()
													.multiply(
															new BigDecimal(
																	item.getProductNum())));
								} else {
									orderItemWeightsOnSellerCoupon
											.add(BigDecimal.ZERO);
									orderWeightOnSellerCoupon = orderWeightOnSellerCoupon
											.add(BigDecimal.ZERO);
								}
							}
							// 商家优惠信息
							if (group.getSellerPromotions() != null) {

								for (SellerPromotionVo sellerPromotion : group
										.getSellerPromotions()) {
									if (sellerPromotion.getProductIds()
											.contains(item.getProductId())) {
										item.setSellerPromotion(sellerPromotion);
									}
								}
							}
						}

						order.setTotalEarnestPrice(totalEarnestPrice);
						order.setTotalOriginalPrice(totalOriginalPrice);
						order.setTotalProductPrice(totalProductPrice);
						order.setOrderItemWeightsOnFreight(orderItemWeightsOnFreight);
						order.setOrderItemWeightsOnYmatouCoupon(orderItemWeightsOnYmatouCoupon);
						order.setOrderItemWeightsOnSellerCoupon(orderItemWeightsOnSellerCoupon);;
						// 商家使用商家优惠券商品的总成交价
						order.setTotalProductPriceInSellerCoupon(orderItemWeightsOnSellerCoupon
								.stream().reduce(BigDecimal.ZERO,
										BigDecimal::add));
						// 所有订单总的成交价
						sumOrdersPrice = sumOrdersPrice.add(totalProductPrice);

						orderWeightsOnYmatouCouponList
								.add(orderWeightOnYmtCoupon);
						orderWeightsOnSellerCouponList
								.add(orderWeightOnSellerCoupon);
					}
					group.setOrderWeightsOnSellerCoupon(orderWeightsOnSellerCouponList);
				}

				if (placeorderBean.getYmatouCoupon() != null) {

					// 计算分摊到各个订单下的平台券金额
					BigDecimal[] ymtResult = apportionByWeights(placeorderBean
							.getYmatouCoupon().getCouponValue(),
							orderWeightsOnYmatouCouponList
									.toArray(new BigDecimal[0]));

					//分摊平台券金额到各个订单上
					for (int i = 0; i < ymtResult.length; i++) {

						orderList.get(i).setYmatouCouponValue(
								ymtResult[i].setScale(2));

						if (ymtResult[i].compareTo(BigDecimal.ZERO) > 0) {
							orderList.get(i).setYmatouCouponCode(
									placeorderBean.getYmatouCoupon()
											.getCouponCode());
						}

					}
				}

				// 分摊商家券到订单
				for (OrderGroupVo group : placeorderBean.getOrderGroups()) {
					if (group.getSellerCoupon() != null) {
						BigDecimal sellerCouponValue = group.getSellerCoupon()
								.getCouponValue();
						String sellerCouponCode = group.getSellerCoupon()
								.getCouponCode();

						// 计算分摊到各个订单下的商家券金额
						BigDecimal[] sellerResult = apportionByWeights(
								sellerCouponValue, group
										.getOrderWeightsOnSellerCoupon()
										.toArray(new BigDecimal[0]));

						//分摊平台券金额到各个订单上
						for (int i = 0; i < group.getOrders().size(); i++) {
							group.getOrders()
									.get(i)
									.setSellerCouponValue(
											sellerResult[i].setScale(2));
							if (sellerResult[i].compareTo(BigDecimal.ZERO) > 0) {
								group.getOrders().get(i)
										.setSellerCouponCode(sellerCouponCode);
							}
						}
					}
				}

				// 分摊券到订单里的各个商品上
				for (OrderGroupVo group : placeorderBean.getOrderGroups()) {

					if (group.getSellerCoupon() != null) {

						for (OrderVo order : group.getOrders()) {

							// 平台券
							BigDecimal[] ymtResult = apportionByWeights(
									order.getYmatouCouponValue(),
									order.getOrderItemWeightsOnYmatouCoupon()
											.toArray(new BigDecimal[0]));

							String ymtOrderCouponCode = order
									.getYmatouCouponCode();
							// 商家券
							BigDecimal[] sellerResult = apportionByWeights(
									order.getSellerCouponValue(),
									order.getOrderItemWeightsOnSellerCoupon()
											.toArray(new BigDecimal[0]));

							String sellerOrderCouponCode = order
									.getSellerCouponCode();
							// 运费
							BigDecimal[] freightResult = apportionByWeights(
									order.getFreight(), order
											.getOrderItemWeightsOnFreight()
											.toArray(new BigDecimal[0]));

							for (int i = 0; i < order.getOrderItems().size(); i++) {

								if (!DataUtil.isNullOrEmpty(ymtResult)) {

									// 分摊平台券
									order.getOrderItems()
											.get(i)
											.setYmatouCouponValue(
													ymtResult[i].divide(
															BigDecimal.ONE, 2,
															4));
								}

								// 商家券
								order.getOrderItems()
										.get(i)
										.setSellerCouponValue(
												sellerResult[i].divide(
														BigDecimal.ONE, 2, 4));
								// 分摊运费
								order.getOrderItems()
										.get(i)
										.setDividedFreight(
												freightResult[i].divide(
														BigDecimal.ONE, 2, 4));
							}
						}
					}
				}

				// 分摊商家优惠到订单下商品上
				for (OrderGroupVo group : placeorderBean.getOrderGroups()) {

					if (group.getSellerPromotions() != null) {

						for (SellerPromotionVo p : group.getSellerPromotions()) {
							// 订单项关于该优惠的权重
							List<BigDecimal> weights = new ArrayList<BigDecimal>();
							// 是否有商品适用该优惠
							boolean applied = false;

							for (OrderVo o : group.getOrders()) {
								for (OrderItemVo item : o.getOrderItems()) {

									if (item.getSellerPromotion() == p) {
										weights.add(item
												.getProductPrice()
												.multiply(
														new BigDecimal(
																item.getProductNum())));
										applied = true;
									} else {
										weights.add(BigDecimal.ZERO);
									}
								}
							}

							if (applied) { // 避免除0
								BigDecimal[] apportions = apportionByWeights(
										p.getReducedAmount(),
										weights.toArray(new BigDecimal[0]));
								int i = 0;
								for (OrderVo o : group.getOrders()) {
									for (OrderItemVo item : o.getOrderItems()) {
										if (apportions[i]
												.compareTo(BigDecimal.ZERO) > 0) {
											item.setSellerPromotionAmount(apportions[i]);
											o.setSellerPromotionAmount(o
													.getSellerPromotionAmount()
													.add(apportions[i]));
										}
										i++;
									}
								}
							}

						}
					}
				}

				// productPrice -> fProductPrice
				// earnestPrice - > fOriginalPrice
				// originalPrice -> fProductOriginalPrice
				int k = 0;
				// 遍历每个买手
				for (int i = 0; i < sellerCount; i++) {
					// 每个买手下的所有订单数，遍历每个订单
					int sellerOrderCount = placeorderBean.getOrderGroups()
							.get(i).getOrders().size();
					// 遍历一个买手下的所有订单
					for (int j = 0; j < sellerOrderCount; j++) {
						// 按接口返回的订单号遍历
						int orderId = orderIds.getInt(k);

						Logger.comment("校验订单号:" + orderId);
						// 订单主表
						List<Map> ymtOrders = database
								.selectOrderByOderId(orderId);
						// 订单商品明细
						List<Map> ymtOrdersInfoList = database
								.selectOrderInfoByOderId(orderId);
						// 订单扩展表
						List<Map> ymtOrdersExt = database
								.selectOrderExtByOderId(orderId);
						// 活动记录表
						List<Map> ymtOrderInfoExt = database
								.selectOrderInfoExtByOderId(orderId);
						// ymtOrderState 表
						List<Map> ymtOrderState = database
								.selectOrderStateByOderId(orderId);
						// Ymt_SellerPromotion 表
						List<Map> ymtSellerPromotion = database
								.selectSellerPromotion(orderId);
						// 单个订单定金价格
						BigDecimal fOriginalPrice = BigDecimal.ZERO;
						// 单个订单商品价格
						BigDecimal fProductPrice = BigDecimal.ZERO;

						BigDecimal orderFreight = BigDecimal.ZERO;

						try {

							// 当前买手下,当前一个订单的运费
							orderFreight = placeorderBean.getOrderGroups()
									.get(i).getOrders().get(j).getOrderItems()
									.stream().map(item -> item.getFreight())
									.reduce(BigDecimal.ZERO, BigDecimal::add);

						} catch (Exception e) {
							// TODO: handle exception
							orderFreight = BigDecimal.ZERO;
						}

						Logger.comment("验证ymt_orders表");
						Logger.verifyEquals(placeorderBean.getUserId(),
								(Integer) ymtOrders.get(0).get("iUserId"),
								"验证iUserId");
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getSellerId(),
								(Integer) ymtOrders.get(0).get("iBuyerId"),
								"验证iBuyerId");
						// fOrderPrice=ymt_ordersInfo.fOriginalPriceiAmount
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j)
								.getTotalEarnestPrice().setScale(2),
								(BigDecimal) ymtOrders.get(0)
										.get("fOrderPrice"), "验证fOrderPrice");

						Logger.verifyEquals(orderFreight.setScale(2),
								(BigDecimal) ymtOrders.get(0).get("fFreight"),
								"验证fFreight");

						Logger.verifyEquals(1,
								(Integer) ymtOrders.get(0)
										.get("iTradingStatus"),
								"验证iTradingStatus");
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getAddress(),
								(String) ymtOrders.get(0).get("sAddress"),
								"验证sAddress");
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getPostCode(),
								(String) ymtOrders.get(0).get("sPostCode"),
								"验证sPostCode");
						Logger.verifyEquals(
								placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j).getReceiveName(),
								(String) ymtOrders.get(0).get("sReceivePerson"),
								"验证sReceivePerson");
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getPhone(),
								(String) ymtOrders.get(0).get("sPhone"),
								"验证sPhone");
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getTelephone(),
								(String) ymtOrders.get(0).get("sTelephone"),
								"验证sTelephone");

						if (placeorderBean.getOrderGroups().get(i).getOrders()
								.get(j).getAutoCancelOrderHours() != null) {
							Logger.verifyEquals(
									placeorderBean.getOrderGroups().get(i)
											.getOrders().get(j)
											.getAutoCancelOrderHours()
											.divide(new BigDecimal(1), 2, 4),
									(BigDecimal) ymtOrders.get(0).get(
											"fAutoCancelOrderHours"),
									"验证fAutoCancelOrderHours");
						} else { // 默认自动取消时间为1小时
							Logger.verifyEquals(
									new BigDecimal(1).divide(new BigDecimal(1),
											2, 4),
									(BigDecimal) ymtOrders.get(0).get(
											"fAutoCancelOrderHours"),
									"验证fAutoCancelOrderHours 默认值为1小时");
						}
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getLeaveWord(),
								(String) ymtOrders.get(0).get("sLeaveWord"),
								"验证sLeaveWord");
						Logger.verifyEquals(
								0,
								(Integer) ymtOrders.get(0).get(
										"iUnfreezeStatus"), "验证iUnfreezeStatus");
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getPaidFull(),
								(Boolean) ymtOrders.get(0).get("bPaidInFull"),
								"验证bPaidInFull");
						// fTotalPrice=ymt_ordersInfo.fProductPriceiAmount
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j)
								.getTotalProductPrice().setScale(2),
								(BigDecimal) ymtOrders.get(0)
										.get("fTotalPrice"), "验证fTotalPrice");
						BigDecimal ymtOrderCouponValue = placeorderBean
								.getOrderGroups().get(i).getOrders().get(j)
								.getYmatouCouponValue();

						// 废弃
						/*
						 * Logger.verifyEquals(
						 * placeorderBean.getOrderGroups().get
						 * (i).getOrders().get(j).getYmatouCouponCode() == null
						 * ? placeorderBean
						 * .getOrderGroups().get(i).getOrders().
						 * get(j).getSellerCouponCode() :
						 * placeorderBean.getOrderGroups
						 * ().get(i).getOrders().get(j) .getYmatouCouponCode(),
						 * (String) ymtOrders .get(0).get("sCouponCode"),
						 * "验证sCouponCode");
						 */
						/*
						 * Logger.verifyEquals(
						 * placeorderBean.getOrderGroups().get
						 * (i).getOrders().get(j).getYmatouCouponValue()
						 * .compareTo(BigDecimal.ZERO) == 0 ? placeorderBean
						 * .getOrderGroups
						 * ().get(i).getOrders().get(j).getSellerCouponValue() :
						 * placeorderBean
						 * .getOrderGroups().get(i).getOrders().get(j)
						 * .getYmatouCouponValue(), (BigDecimal) ymtOrders
						 * .get(0).get("CouponValue"), "验证CouponValue");
						 */

						// 订单成交价
						BigDecimal fTotalPrice = (BigDecimal) ymtOrders.get(0)
								.get("fTotalPrice");
						// 订单运费
						BigDecimal fFreight = (BigDecimal) ymtOrders.get(0)
								.get("fFreight");
						// 商家优惠券
						BigDecimal fSellerCouponAmount = (BigDecimal) ymtOrders
								.get(0).get("fSellerCouponAmount");
						// 平台优惠券
						BigDecimal fYmtCouponAmount = (BigDecimal) ymtOrders
								.get(0).get("fYmtCouponAmount");
						// 商家优惠减免金额
						BigDecimal fSellerPromotionAmount = (BigDecimal) ymtOrders
								.get(0).get("fSellerPromotionAmount");
						BigDecimal needPayableAmount = fTotalPrice
								.add(fFreight).subtract(fSellerCouponAmount)
								.subtract(fYmtCouponAmount)
								.subtract(fSellerPromotionAmount);
						Logger.verifyEquals(needPayableAmount, ymtOrders.get(0)
								.get("fPayableAmount"), "验证fPayableAmount");
						/*
						 * Logger.verifyEquals( 1, (Integer) ymtOrders
						 * .get(0).get("iCouponType"), "验证iCouponType");
						 * Logger.verifyEquals
						 * (placeorderBean.getOrderGroups().get
						 * (i).getOrders().get(j) .getYmatouCouponCode(),
						 * 
						 * ymtOrders.get(0).get("sYmtCouponCode"),
						 * "验证sYmtCouponCode");
						 */
						DataUtil.verifyDecimalEquals(placeorderBean
								.getOrderGroups().get(i).getOrders().get(j)
								.getYmatouCouponValue(), (BigDecimal) ymtOrders
								.get(0).get("fYmtCouponAmount"),
								"验证fYmtCouponAmount");
						Logger.verifyEquals(
								placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j)
										.getSellerCouponCode(),
								(String) ymtOrders.get(0).get(
										"sSellerCouponCode"),
								"验证sSellerCouponCode");
						DataUtil.verifyDecimalEquals(placeorderBean
								.getOrderGroups().get(i).getOrders().get(j)
								.getSellerCouponValue(),
								ymtOrders.get(0).get("fSellerCouponAmount"),
								"验证fSellerCouponAmount");

						Logger.verifyEquals(tradingId,
								(Integer) ymtOrders.get(0).get("iMainOrderId"),
								"验证iMainOrderId");
						boolean isShangou = placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getPaidFull()
								? false
								: true;
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getMerchant()
								? 1
								: 0,
								(Integer) ymtOrders.get(0).get("iIsMerchant"),
								"验证iIsMerchant");
						Logger.verifyEquals(
								isShangou,
								(Boolean) ymtOrders.get(0).get("bShangouOrder"),
								"验证bShangouOrder");
						Logger.verifyEquals(placeorderBean.getOrderGroups()
								.get(i).getOrders().get(j).getPaidFull(),
								(Boolean) ymtOrders.get(0).get("bFullPay"),
								"验证bFullPay");

						Logger.verifyEquals(
								placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j)
										.getSellerPromotionAmount()
										.divide(BigDecimal.ONE, 2, 4),
								(BigDecimal) ymtOrders.get(0).get(
										"fSellerPromotionAmount"),
								"验证fSellerPromotionAmount");
						// 该订单下，有多个商品 遍历校验 ymt_ordersInfo
						if (ymtOrdersInfoList.size() > 0) {
							for (int m = 0; m < ymtOrdersInfoList.size(); m++) {
								Map ymtOrdersInfo = ymtOrdersInfoList.get(m);
								Logger.comment("验证ymt_ordersInfo表,商品" + (m + 1));
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().size(),
										ymtOrdersInfoList.size(),
										"验证ymt_ordersInfo表记录数");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getCatalogId(), (String) ymtOrdersInfo
										.get("sCatalogId"), "验证sCatalogId");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getProperty(), (String) ymtOrdersInfo
										.get("sPropertyInfo"),
										"验证sPropertyInfo");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getProductName(),
										(String) ymtOrdersInfo.get("sTitle"),
										"验证sTitle");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getPictureUrl(),
										(String) ymtOrdersInfo
												.get("sPictureUrl"),
										"验证sPictureUrl");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getEarnestPrice().setScale(2),
										(BigDecimal) ymtOrdersInfo
												.get("fOriginalPrice"),
										"验证fOriginalPrice");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getProductNum(),
										(Integer) ymtOrdersInfo.get("iAmount"),
										"验证iAmount");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getStockStatus() == null
										? 0
										: placeorderBean.getOrderGroups()
												.get(i).getOrders().get(j)
												.getOrderItems().get(m)
												.getStockStatus().getCode(),
										(Integer) ymtOrdersInfo
												.get("iCatalogType"),
										"验证iCatalogType");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getLogisticsType().getCode(),
										(Integer) ymtOrdersInfo
												.get("iCatalogStatus"),
										"验证iCatalogStatus");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getProductId(), (String) ymtOrdersInfo
										.get("sProductId"), "验证sProductId");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getFirstCategoryId(),
										(Integer) ymtOrdersInfo
												.get("iProductMainCategoryId"),
										"验证iProductMainCategoryId");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getSecondCategoryId(),
										(Integer) ymtOrdersInfo
												.get("iProductSubCategoryId"),
										"验证iProductSubCategoryId");
								Logger.verifyEquals(
										(placeorderBean.getOrderGroups().get(i)
												.getOrders().get(j)
												.getOrderItems().get(m)
												.getThirdCategoryId()),
										(Integer) ymtOrdersInfo
												.get("iProductThirdCategoryId"),
										"验证iProductThirdCategoryId");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getBrandId(), (Integer) ymtOrdersInfo
										.get("iProductBrandId"),
										"验证iProductBrandId");
								Integer bondArea = null;
								if (placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j).getOrderItems()
										.get(m).getBondedArea() != null) {
									bondArea = placeorderBean.getOrderGroups()
											.get(i).getOrders().get(j)
											.getOrderItems().get(m)
											.getBondedArea().getCode();
								}
								Logger.verifyEquals(bondArea,
										(Integer) ymtOrdersInfo
												.get("iBondedArea"),
										"验证iBondedArea");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getProductRecordNo(),
										(String) ymtOrdersInfo
												.get("sProductCode"),
										"验证sProductCode");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getTariffType(),
										(Integer) ymtOrdersInfo
												.get("iTariffType"),
										"验证iTariffType");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getPriceType().getCode(),
										(Integer) ymtOrdersInfo
												.get("iPriceType"),
										"验证iPriceType");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getPackageNo(), (String) ymtOrdersInfo
										.get("sPackageNo"), "验证sPackageNo");

								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getProductRefundChannel().getCode(),
										(Integer) ymtOrdersInfo
												.get("iProductRefundChannel"),
										"验证iProductRefundChannel");
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getProductPrice().setScale(2),
										(BigDecimal) ymtOrdersInfo
												.get("fProductPrice"),
										"验证fProductPrice");
								// 订单里商品的 价格乘以数量
								fProductPrice = placeorderBean
										.getOrderGroups()
										.get(i)
										.getOrders()
										.get(j)
										.getOrderItems()
										.get(m)
										.getProductPrice()
										.multiply(
												new BigDecimal(placeorderBean
														.getOrderGroups()
														.get(i).getOrders()
														.get(j).getOrderItems()
														.get(m).getProductNum()));
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getSalesType().getCode(),
										(Integer) ymtOrdersInfo
												.get("iSalesType"),
										"验证iSalesType");;
								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getFreightFree(),
										(Boolean) ymtOrdersInfo
												.get("bFreightFree"),
										"验证bFreightFree");

								Logger.comment("验证ymt_orderInfo表计算优惠券,运费分摊");

								DataUtil.verifyDecimalEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getSellerCouponValue(),
										(BigDecimal) ymtOrdersInfo
												.get("fSellerCouponAmount"),
										"验证fSellerCouponAmount");
								DataUtil.verifyDecimalEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getYmatouCouponValue(),
										(BigDecimal) ymtOrdersInfo
												.get("fYmtCouponAmount"),
										"验证fYmtCouponAmount");

								DataUtil.verifyDecimalEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getFreight(),
										(BigDecimal) ymtOrdersInfo
												.get("fFreight"),
										"验证订单上商品fFreight");

								Logger.verifyEquals(
										placeorderBean.getOrderGroups().get(i)
												.getOrders().get(j)
												.getOrderItems().get(m)
												.getSupportsRtnWithoutReason(),
										(Boolean) ymtOrdersInfo
												.get("bSupportRtnWithoutReason"),
										"验证bSupportRtnWithoutReason");

								Logger.verifyEquals(
										placeorderBean.getOrderGroups().get(i)
												.getOrders().get(j)
												.getOrderItems().get(m)
												.getPreSale(),
										(Boolean) ymtOrdersInfo.get("bPreSale"),
										"验证bPreSale");

								Logger.verifyEquals(placeorderBean
										.getOrderGroups().get(i).getOrders()
										.get(j).getOrderItems().get(m)
										.getPspProduct(),
										(Boolean) ymtOrdersInfo
												.get("bPspProduct"),
										"验证bPspProduct");

								Logger.verifyEquals(
										placeorderBean.getOrderGroups().get(i)
												.getOrders().get(j)
												.getOrderItems().get(m)
												.getSellerPromotionAmount()
												.setScale(2),
										(BigDecimal) ymtOrdersInfo
												.get("fSellerPromotionAmount"),
										"验证fSellerPromotionAmount");

								if (placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j).getOrderItems()
										.get(m).getSellerPromotion() != null) {
									Logger.comment("验证ymt_sellerPromotion表");
									for (Map map : ymtSellerPromotion) {
										if (((String) map.get("sProductId"))
												.equals(placeorderBean
														.getOrderGroups()
														.get(i).getOrders()
														.get(j).getOrderItems()
														.get(m).getProductId())) {
											Logger.verifyEquals(
													placeorderBean
															.getOrderGroups()
															.get(i)
															.getOrders()
															.get(j)
															.getOrderItems()
															.get(m)
															.getSellerPromotion()
															.getType()
															.getCode(),
													(Integer) map
															.get("PromotionType"),
													"验证PromotionType");
											Logger.verifyEquals(
													placeorderBean
															.getOrderGroups()
															.get(i)
															.getOrders()
															.get(j)
															.getOrderItems()
															.get(m)
															.getSellerPromotion()
															.getId(),
													Integer.valueOf((Integer) map
															.get("PromotionId")),
													"验证PromotionId");
											Logger.verifyEquals(placeorderBean
													.getOrderGroups().get(i)
													.getOrders().get(j)
													.getOrderItems().get(m)
													.getSellerPromotion()
													.getName(), (String) map
													.get("PromotionName"),
													"验证PromotionName");
											Logger.verifyEquals(
													String.valueOf(placeorderBean
															.getOrderGroups()
															.get(i)
															.getOrders()
															.get(j)
															.getOrderItems()
															.get(m)
															.getSellerPromotion()
															.getQtyCondition()),
													(String) map
															.get("MatchCondition"),
													"验证MatchCondition");
											Logger.verifyEquals(placeorderBean
													.getOrderGroups().get(i)
													.getOrders().get(j)
													.getOrderItems().get(m)
													.getSellerPromotion()
													.getPromotionValue()
													.toString(), (String) map
													.get("PromotionValue"),
													"验证PromotionValue");
											Logger.verifyEquals(
													(placeorderBean
															.getOrderGroups()
															.get(i)
															.getOrders()
															.get(j)
															.getOrderItems()
															.get(m)
															.getSellerPromotion()
															.getReducedAmount())
															.setScale(2),
													(BigDecimal) map
															.get("ReducedAmount"),
													"验证ReducedAmount");
										}

									}

								}

								if (placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j).getOrderItems()
										.get(m).getActivity() != null) {
									Logger.comment("验证ymt_ordersInfoExt表");
									// Logger.verifyEquals(1,
									// ymtOrderInfoExt.size(),
									// "验证ymt_ordersInfoExt表记录数");
									Logger.verifyEquals(placeorderBean
											.getOrderGroups().get(i)
											.getOrders().get(j).getOrderItems()
											.get(m).getActivity()
											.getActivityId(),
											(Integer) ymtOrderInfoExt.get(j)
													.get("iActivityId"),
											"验证iActivityId");
									Logger.verifyEquals(
											placeorderBean.getOrderGroups()
													.get(i).getOrders().get(j)
													.getOrderItems().get(m)
													.getActivity()
													.getActivityTemplateId(),
											(Integer) ymtOrderInfoExt.get(j)
													.get("iActivityTemplateId"),
											"验证iActivityTemplateId");

									Logger.verifyEquals(placeorderBean
											.getOrderGroups().get(i)
											.getOrders().get(j).getOrderItems()
											.get(m).getActivity()
											.getPromotionType().getCode(),
											(Integer) ymtOrderInfoExt.get(j)
													.get("iPromotionType"),
											"验证iPromotionType");
									Logger.verifyEquals(placeorderBean
											.getOrderGroups().get(i)
											.getOrders().get(j).getOrderItems()
											.get(m).getActivity()
											.getPromotionPrice().setScale(2),
											(BigDecimal) ymtOrderInfoExt.get(j)
													.get("fPromotion"),
											"验证fPromotion");
									Logger.verifyEquals(placeorderBean
											.getOrderGroups().get(i)
											.getOrders().get(j).getOrderItems()
											.get(m).getActivity().getFeeFree(),
											(Boolean) ymtOrderInfoExt.get(j)
													.get("bFeeFree"),
											"验证bFeeFree");
									Logger.verifyEquals(
											placeorderBean
													.getOrderGroups()
													.get(i)
													.getOrders()
													.get(j)
													.getOrderItems()
													.get(m)
													.getActivity()
													.getCommissionRate()
													.setScale(
															2,
															BigDecimal.ROUND_DOWN),
											(BigDecimal) ymtOrderInfoExt.get(j)
													.get("fCommissionRate"),
											"验证fCommissionRate");
									Logger.verifyEquals(placeorderBean
											.getOrderGroups().get(i)
											.getOrders().get(j).getOrderItems()
											.get(m).getActivity().getPremium()
											.setScale(2),
											(BigDecimal) ymtOrderInfoExt.get(j)
													.get("fPremium"),
											"验证fPremium");
									Logger.verifyEquals(placeorderBean
											.getOrderGroups().get(i)
											.getOrders().get(j).getOrderItems()
											.get(m).getActivity().getCost(),
											(Boolean) ymtOrderInfoExt.get(j)
													.get("bIsCost"),
											"验证bIsCost");
									Logger.verifyEquals(
											placeorderBean.getOrderGroups()
													.get(i).getOrders().get(j)
													.getOrderItems().get(m)
													.getActivity()
													.getSupportCouponType() == null
													? null
													: placeorderBean
															.getOrderGroups()
															.get(i)
															.getOrders()
															.get(j)
															.getOrderItems()
															.get(m)
															.getActivity()
															.getSupportCouponType()
															.getCode(),
											(Integer) ymtOrderInfoExt
													.get(j)
													.get("bSupportRtnWithoutReason"),
											"验证bSupportRtnWithoutReason");
								}

							}

						}
						Logger.comment("验证ymt_ordersExt表");

						Logger.verifyEquals(1, ymtOrdersExt.size(),
								"验证ymt_ordersExt表记录数");
						Logger.verifyEquals(placeorderBean.getOrderSource()
								.toString(),
								(String) ymtOrdersExt.get(0)
										.get("sOrderSource"), "验证sOrderSource");
						Logger.verifyEquals(
								placeorderBean.getSourceIp(),
								(String) ymtOrdersExt.get(0).get(
										"sOrderSourceIP"), "验证sOrderSourceIP");
						Logger.verifyEquals(
								placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j).getPaidFull()
										? 0
										: 1,
								(Integer) ymtOrdersExt.get(0).get("iOrderType"),
								"验证iOrderType");
						Logger.verifyEquals(
								placeorderBean.getTerminalSource().toString(),
								(String) ymtOrdersExt.get(0).get(
										"sTerminalSource"), "验证sTerminalSource");
						Logger.verifyEquals(
								placeorderBean.getAppTerminalSource()
										.toString(),
								(String) ymtOrdersExt.get(0).get(
										"sAppTerminalSource"),
								"验证sAppTerminalSource");
						Logger.verifyEquals(placeorderBean.getDeviceId(),
								(String) ymtOrdersExt.get(0).get("sDeviceId"),
								"验证sDeviceId");
						Logger.verifyEquals(placeorderBean.getEquipmentId(),
								(String) ymtOrdersExt.get(0)
										.get("sEquipmentId"), "验证sEquipmentId");

						Logger.verifyEquals(
								placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j).getEcommerceFlag(),
								(Boolean) ymtOrdersExt.get(0).get(
										"bEcommerceFlag"), "验证bEcommerceFlag");

						Logger.comment("验证ymt_orderState表");
						Logger.verifyEquals(1, ymtOrderState.size(),
								"验证ymt_orderState表");

						DataUtil.verifyDecimalEquals(
								placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j)
										.getSellerCouponValue(),
								(BigDecimal) ymtOrderState.get(0).get(
										"fPaidAmountOfSellerCoupon"),
								"验证fPaidAmountOfSellerCoupon");
						DataUtil.verifyDecimalEquals(
								placeorderBean.getOrderGroups().get(i)
										.getOrders().get(j)
										.getYmatouCouponValue(),
								(BigDecimal) ymtOrderState.get(0).get(
										"fPaidAmountOfYmtCoupon"),
								"验证fPaidAmountOfYmtCoupon");
						/*
						 * Logger.verifyEquals( (BigDecimal)
						 * ymtOrders.get(0).get("CouponValue"), (BigDecimal)
						 * ymtOrderState.get(0).get("fPaidAmountOfCoupon"),
						 * "验证fPaidAmountOfCoupon");
						 */
						// 订单数量加1
						k++;
					}
				}
				List<Map> ymtOrdersinfo2 = database
						.selectOrderByMainOderId(tradingId);
				BigDecimal payableAmount = BigDecimal.ZERO;
				for (int i = 0; i < ymtOrdersinfo2.size(); i++) {
					BigDecimal fOrderPrice = (BigDecimal) ymtOrdersinfo2.get(i)
							.get("fOrderPrice");
					BigDecimal fFreight = (BigDecimal) ymtOrdersinfo2.get(i)
							.get("fFreight");
					// 商家优惠券
					BigDecimal fSellerCouponAmount = (BigDecimal) ymtOrdersinfo2
							.get(i).get("fSellerCouponAmount");
					// 平台优惠券
					BigDecimal fYmtCouponAmount = (BigDecimal) ymtOrdersinfo2
							.get(i).get("fYmtCouponAmount");
					// 商家优惠减免金额
					BigDecimal fSellerPromotionAmount = (BigDecimal) ymtOrdersinfo2
							.get(i).get("fSellerPromotionAmount");
					BigDecimal needPayableAmount = fOrderPrice.add(fFreight)
							.subtract(fSellerCouponAmount)
							.subtract(fYmtCouponAmount)
							.subtract(fSellerPromotionAmount);
					payableAmount = needPayableAmount.add(payableAmount);
				}
				List<Map> ymtTradinginfo = database
						.selectTradinginfoByTradingId(tradingId);
				Logger.comment("验证ymt_tradinginfo表");
				Logger.verifyEquals(tradingId, (Integer) ymtTradinginfo.get(0)
						.get("iTradingId"), "验证iTradingId");
				Logger.verifyEquals(placeorderBean.getUserId(),
						(Integer) ymtTradinginfo.get(0).get("iUserId"),
						"验证iUserId");
				Logger.verifyEquals(1,
						(Integer) ymtTradinginfo.get(0).get("iTradingStatus"),
						"验证iTradingStatus");
				// 交易应付金额=总订金+总运费-总优惠券金额
				Logger.verifyEquals(payableAmount.setScale(2),
						(BigDecimal) ymtTradinginfo.get(0).get("fAmount"),
						"验证fAmount");
				Logger.verifyEquals(payableAmount.setScale(2),
						(BigDecimal) ymtTradinginfo.get(0)
								.get("fPayableAmount"), "验证fPayableAmount");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	private void verifyBaseInfo() {

		JSONArray orderIds = placeorderCall.getOrderIds();
		int userId = placeorderBean.getUserId();
		// 订单主表
		List<Map> ymtOrders;
		try {
			// 异步处理等待3s
			Thread.sleep(3000);

			for (int i = 0; i < orderIds.length(); i++) {

				int orderId = orderIds.getInt(i);

				ymtOrders = database.selectOrderByOderId(orderId);

				int sellerId = (Integer) ymtOrders.get(0).get("iBuyerId");

				Logger.comment("验证订单:" + orderId + "买手:" + sellerId + "基本信息");

				Userinfo sellerInfo = new JUserWapper().selectUserinfoByUid(
						sellerId).get(0);

				Logger.verifyEquals(sellerInfo.getLoginId(), (String) ymtOrders
						.get(0).get("sSellerLoginId"), "验证sSellerLoginId");
				Logger.verifyEquals(sellerInfo.getLoginMail(),
						(String) ymtOrders.get(0).get("sSellerLoginEmail"),
						"验证sSellerLoginEmail");

				Userinfo userinfo = new JUserWapper().selectUserinfoByUid(
						userId).get(0);

				Userinfoex userinfoex = new JUserWapper()
						.selectUserinfoexByUid(userId).get(0);

				Logger.comment("验证订单:" + orderId + "买家" + userId + "基本信息");
				Logger.verifyEquals(userinfoex.getQQ(),
						(String) ymtOrders.get(0).get("sQQ"), "验证sQQ");
				Logger.verifyEquals(userinfo.getLoginMail(), (String) ymtOrders
						.get(0).get("sEmail"), "验证sEmail");
				Logger.verifyEquals(userinfo.getLoginId(), (String) ymtOrders
						.get(0).get("sBuyerLoginId"), "验证sBuyerLoginId");
				Logger.verifyEquals(userinfo.getLoginMail(), (String) ymtOrders
						.get(0).get("sBuyerLoginEmail"), "验证sBuyerLoginEmail");
				Logger.verifyEquals(userinfo.getLoginId(), (String) ymtOrders
						.get(0).get("sBuyerNickName"), "验证sBuyerNickName");
			}

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	private void verifyBargainGroup() {
		try {
			JSONArray orderIds = placeorderCall.getOrderIds();

			Integer orderId = Integer.valueOf(orderIds.getInt(0));

			Map m = new HashMap();
			m.put("orderId", orderId);

			List<BizVo> bizVos = database.selectYmtOrderbiz(m);
			BizVo bizVo = new BizVo();
			if (bizVos.size() > 0) {
				bizVo = bizVos.get(0);
			} else {
				bizVo = null;
			}

			Logger.comment("校验ymt_orderbiz表");
			Logger.verifyEquals(placeorderBean.getBizSource().getBizId(),
					bizVo.getBizId(), "验证BizId");
			Logger.verifyEquals(orderId, bizVo.getOrderId(), "验证OrderId");
			Logger.verifyEquals(placeorderBean.getBizSource().getBizType(),
					bizVo.getBizType(), "验证BizType");
			Logger.verifyEquals(
					placeorderBean.getBizSource().getBizSubType() == null
							? 0
							: placeorderBean.getBizSource().getBizSubType(),
					bizVo.getBizSubType(), "验证BizSubType");
			Logger.verifyEquals(0, bizVo.getBizStatus(), "验证BizStatus");

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	//第二件半价
	private void verifyHalfIfCountEnough() {

		BigDecimal ExpectlPromotionValue = placeorderBean.getOrderGroups()
				.get(0).getSellerPromotionApportions().stream()
				.map(s -> s.getReducedAmount())
				.reduce(BigDecimal.ZERO, BigDecimal::add);

		if (null != placeorderBean.getOrderGroups().get(0)
				.getSellerPromotions()) {
			ExpectlPromotionValue = ExpectlPromotionValue.add(placeorderBean
					.getOrderGroups().get(0).getSellerPromotions().stream()
					.map(s -> s.getReducedAmount())
					.reduce(BigDecimal.ZERO, BigDecimal::add));
		}

		int mainOrderId = placeorderCall.getMainOrderId();

		DefaultWapper database = new DefaultWapper();

		// 订单主表
		List<Map> ymtOrders = database.selectOrderByMainOderId(mainOrderId);

		BigDecimal actualPromotionValue = ymtOrders.stream()
				.map(m -> (BigDecimal) m.get("fSellerPromotionAmount"))
				.reduce(BigDecimal.ZERO, BigDecimal::add);

		DataUtil.verifyDecimalEquals(ExpectlPromotionValue,
				actualPromotionValue, "校验主单下所有订单总优惠");

		BigDecimal actualOrderInfoPromotionValue = BigDecimal.ZERO;

		for (Map m : ymtOrders) {

			int orderId = (Integer) m.get("iOrderId");
			// 订单商品明细
			List<Map> ymtOrdersInfoList = database
					.selectOrderInfoByOderId(orderId);

			BigDecimal tempPromotionValue = ymtOrdersInfoList.stream()
					.map(O -> (BigDecimal) O.get("fSellerPromotionAmount"))
					.reduce(BigDecimal.ZERO, BigDecimal::add);

			actualOrderInfoPromotionValue = actualOrderInfoPromotionValue
					.add(tempPromotionValue);

		}

		DataUtil.verifyDecimalEquals(ExpectlPromotionValue,
				actualPromotionValue, "校验主单下所有订单商品总优惠");

	}

	/**校验需返库存的数据
	 * 
	 * @param stockInfo
	 */
	private void verifyStockStatus(byte[] stockInfoFile) {

		String stockInfo = extractToString(stockInfoFile);

		List<ReturnStockCatalogInfoVo> list = new ArrayList<ReturnStockCatalogInfoVo>();

		for (OrderGroupVo orderGroup : placeorderBean.getOrderGroups()) {
			for (OrderVo order : orderGroup.getOrders()) {
				for (OrderItemVo orderItem : order.getOrderItems()) {

					ReturnStockCatalogInfoVo stockCatalogInfoVo = new ReturnStockCatalogInfoVo();

					ActivityVo activityVo = orderItem.getActivity();

					if (activityVo != null && activityVo.getActivityId() > 0) {
						stockCatalogInfoVo.setActivityId(activityVo
								.getActivityId());
					}

					stockCatalogInfoVo.setBuyerId(placeorderBean.getUserId());
					stockCatalogInfoVo.setCatalogId(orderItem.getCatalogId());
					stockCatalogInfoVo.setCatalogType(orderItem
							.getStockStatus() != null ? orderItem
							.getStockStatus().getCode() : 0);

					stockCatalogInfoVo.setisLiveProduct(orderItem
							.getSalesType() != null
							&& orderItem.getSalesType().equals(
									SalesTypeEnum.Live));

					stockCatalogInfoVo.setProductId(orderItem.getProductId());
					stockCatalogInfoVo.setSellerId(orderGroup.getSellerId());

					//		stockCatalogInfoVo.setOrderId(order.getOrderId());

					//stockCatalogInfoVo.setOrderAddTime(new Date());
					stockCatalogInfoVo.setOrderIsPaid(false);
					stockCatalogInfoVo.setStockNum(orderItem.getProductNum());
					stockCatalogInfoVo.setPackageNo(orderItem.getPackageNo());

					list.add(stockCatalogInfoVo);

				}
			}
		}

		List<ReturnStockCatalogInfoVo> actualList = (List<ReturnStockCatalogInfoVo>) FormatUtil
				.GSONToObject(stockInfo,
						new TypeToken<List<ReturnStockCatalogInfoVo>>() {
						}.getType());

		for (int i = 0; i < list.size(); i++) {

			ReturnStockCatalogInfoVo expected = list.get(i);

			ReturnStockCatalogInfoVo actual = actualList.get(i);

			Logger.verifyEquals(expected.getActivityId(),
					actual.getActivityId(), "activityId");

			Logger.verifyEquals(expected.getBuyerId(), actual.getBuyerId(),
					"buyerId");

			Logger.verifyEquals(expected.getCatalogId(), actual.getCatalogId(),
					"catalogId");

			Logger.verifyEquals(expected.getCatalogType(),
					actual.getCatalogType(), "catalogType");

			Logger.verifyEquals(expected.getisLiveProduct(),
					actual.getisLiveProduct(), "isLiveProduct");

			/*			Logger.verifyEquals(expected.getOrderAddTime(),
								actual.getOrderAddTime(), "orderAddTime");*/

			Logger.verifyEquals(expected.isOrderIsPaid(),
					actual.isOrderIsPaid(), "orderIsPaid");

			Logger.verifyEquals(expected.getPackageNo(), actual.getPackageNo(),
					"packageNo");

			Logger.verifyEquals(expected.getProductId(), actual.getProductId(),
					"productId");

			Logger.verifyEquals(expected.getSellerId(), actual.getSellerId(),
					"sellerId");

			Logger.verifyEquals(expected.getStockNum(), actual.getStockNum(),
					"stockNum");

		}

	}
	private JSONObject creaderPro(int stockNum) {

		String sellerName = String.valueOf(EnvSetup.getData("SellerName"));
		int sellerId = Integer.valueOf(EnvSetup.getData("SellerId2"));

		Map updateMap = new HashMap();

		updateMap.put("Product->Catalogs[0]->Num", stockNum);

		JSONObject productInfo = null;

		try {

			String proId = SellerProductCallService
					.addNewProductOnSale(sellerId, sellerName, updateMap)
					.getJSONObject("Data").getString("ProductID");

			productInfo = GetProductInfoByProductIdCall
					.GetProductInfoByProductId(proId).getJSONObject("Data")
					.getJSONObject("Product");

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return productInfo;

	}

	private ProductAllPriceBean createActiverPro() {

		try {
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService
					.getProdPriceWithActivity_NewBuyerAndNoIsolation();

			Thread.sleep(5000);

			return productAllPriceBean;

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return null;

	}

	/**
	 * 校验组合商品落地数据
	 */
	private void verifyPackageInfo() {

		try {

			Thread.sleep(5000);

			JSONArray orderIds = placeorderCall.getOrderIds();

			for (int i = 0; i < orderIds.length(); i++) {

				int orderId = orderIds.getInt(i);

				// 订单商品明细
				List<Map> ymtOrdersInfoList = database
						.selectOrderInfoByOderId(orderId);

				List<Map> ymtOrderSub = ymtOrdersInfoList.stream()
						.filter(item -> (Boolean) item.get("bSubProduct"))
						.collect(Collectors.toList());

				if (!CollectionUtils.isEmpty(ymtOrderSub)) {

					for (Map m : ymtOrderSub) {

						String sCatalogId = (String) m.get("sCatalogId");

						BigDecimal fProductPrice = (BigDecimal) m
								.get("fProductPrice");

						int iAmount = (Integer) m.get("iAmount");

						BigDecimal fFreight = (BigDecimal) m.get("fFreight");

						BigDecimal fSellerCouponAmount = (BigDecimal) m
								.get("fSellerCouponAmount");

						BigDecimal fYmtCouponAmount = (BigDecimal) m
								.get("fYmtCouponAmount");

						BigDecimal fSellerPromotionAmount = (BigDecimal) m
								.get("fSellerPromotionAmount");

						Logger.comment(String.format("校验sCatalogId：%s 的组合商品",
								sCatalogId));

						List<OrderInfoSubPo> OrderInfoSubPoList = database
								.getOrderInfoSub(orderId, sCatalogId);

						if (CollectionUtils.isEmpty(OrderInfoSubPoList)) {

							Logger.comment("Ymt_OrderInfoSub 组合商品明细表为空 ");

							return;
						}

						BigDecimal[] weight = new BigDecimal[OrderInfoSubPoList
								.size()];

						for (int j = 0; j < OrderInfoSubPoList.size(); j++) {

							OrderInfoSubPo orderInfoSubPo = OrderInfoSubPoList
									.get(j);

							weight[j] = orderInfoSubPo.getOriginalPrice()
									.multiply(
											new BigDecimal(orderInfoSubPo
													.getNum()));
						}

						BigDecimal price[] = apportionByWeights2(
								fProductPrice.multiply(new BigDecimal(iAmount)),
								weight);

						BigDecimal freight[] = apportionByWeights2(fFreight,
								weight);

						BigDecimal sellerCoupon[] = apportionByWeights2(
								fSellerCouponAmount, weight);

						BigDecimal ymtCoupon[] = apportionByWeights2(
								fYmtCouponAmount, weight);

						BigDecimal sellerPromotionAmount[] = apportionByWeights2(
								fSellerPromotionAmount, weight);

						int k = 0;

						for (OrderInfoSubPo orderInfoSubPo : OrderInfoSubPoList) {

							Logger.comment("校验 Ymt_OrderInfoSub 表 ");

							Logger.comment("校验 SubOrderInfoId :"
									+ orderInfoSubPo.getSubOrderInfoId());

							DataUtil.verifyDecimalEquals(price[k],
									orderInfoSubPo.getPrice(), "校验Price");

							DataUtil.verifyDecimalEquals(freight[k],
									orderInfoSubPo.getFreight(), "校验Freight");
							DataUtil.verifyDecimalEquals(ymtCoupon[k],
									orderInfoSubPo.getYmtCoupon(),
									"校验YmtCoupon");
							DataUtil.verifyDecimalEquals(sellerCoupon[k],
									orderInfoSubPo.getSellerCoupon(),
									"校验SellerCoupon");
							DataUtil.verifyDecimalEquals(
									sellerPromotionAmount[k],
									orderInfoSubPo.getPromotion(),
									"校验Promotion");

							DataUtil.verifyDecimalEquals(BigDecimal.ZERO,
									orderInfoSubPo.getThirdPartyDiscount(),
									"校验ThirdPartyDiscount");
							DataUtil.verifyDecimalEquals(BigDecimal.ZERO,
									orderInfoSubPo.getDiscount(), "校验Discount");

							k++;

						}

					}

				}

			}

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
	/**
	 * 
	 * @param proId
	 * @param catalogId
	 * @param isActivityPro 是否是活动商品
	 * @return
	 */
	public static int getStockNum(String proId, String catalogId,
			boolean isActivityPro) {

		int stockNum = 0;

		try {
			JSONObject productInfo = GetProductInfoByProductIdCall
					.GetProductInfoByProductId(proId).getJSONObject("Data")
					.getJSONObject("Product");
			JSONArray catalogList = productInfo.getJSONArray("CatalogList");

			for (int i = 0; i < catalogList.length(); i++) {

				if (catalogId.equals(catalogList.getJSONObject(i).getString(
						"CatalogId"))) {

					//如果是活动，返回活动库存
					if (isActivityPro) {
						stockNum = catalogList.getJSONObject(i).getInt(
								"ActivityStock");
					} else {
						stockNum = catalogList.getJSONObject(i).getInt(
								"CatalogStock");
					}

					break;

				}

			}

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return stockNum;

	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_001() {
		Logger.start(true, "创建一个C直播订单(odertype=1)扫货");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setOrderType(OrderTypeEnum.Shangou);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();

			// Thread.sleep(3000);
			verifyBaseInfo();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_002() {
		Logger.start(true, "创建一个M直播订单(odertype=0)扫货");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setOrderType(OrderTypeEnum.Spot);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_003() {
		Logger.start(true, "创建一个M活动订单");
		try {
			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setOrderType(OrderTypeEnum.Spot);

			ActivityVo activity = new ActivityVo();
			activity.setActivityId(46870);
			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setActivity(activity);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_004() {
		Logger.start(true, "创建一个订单包含多个不同的商品(一个订单号),同时使用平台,商家优惠券");
		try {
			YmtCouponPrivateUserBoundWapper ymtCouponPrivateUserBoundWapper = new YmtCouponPrivateUserBoundWapper();
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);

			List<YmtCouponPrivateUserBound> listCoupon = ymtCouponPrivateUserBoundWapper
					.selectBysCouponCode(couponCode);
			int ymtBeforeCount = listCoupon.get(0).getiCouponUsedCount();
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			placeorderBean.setSourceIp("127.0.0.1");
			placeorderBean.setAppId("ios");
			placeorderBean.setDeviceId("7777777777888888888888999");
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.PC);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			List<YmtCouponPrivateUserBound> listCoupon2 = ymtCouponPrivateUserBoundWapper
					.selectBysCouponCode(sellerCouponCode);
			int sellerBeforeCount = listCoupon2.get(0).getiCouponUsedCount();

			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Spot);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");
			List<OrderItemVo> items = new ArrayList<OrderItemVo>();

			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setCatalogId(TestDataManager.getRandomUUID().toString());
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(210);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			ActivityVo activity = new ActivityVo();
			activity.setActivityId(46870);
			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);
			orderitem1.setActivity(activity);
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));
			// 第2件商品
			OrderItemVo orderitem2 = new OrderItemVo();
			orderitem2.setCatalogId(TestDataManager.getRandomUUID().toString());
			orderitem2.setProductNum(1);
			orderitem2.setProductName(productName);
			orderitem2.setPriceType(PriceTypeEnum.VipPrice);
			orderitem2.setProductId(productId);
			price = new BigDecimal(270);
			orderitem2.setEarnestPrice(price);
			orderitem2.setProductPrice(price);
			orderitem2.setOriginalPrice(price);
			orderitem2.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem2.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem2.setBrandId(5);
			orderitem2.setPackageNo("11111111");
			orderitem2.setFirstCategoryId(111111111);
			orderitem2.setSecondCategoryId(22222222);
			orderitem2.setThirdCategoryId(3333333);
			orderitem2
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem2.setProductRecordNo("1234567");
			orderitem2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem2
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");

			orderitem2.setActivity(activity);
			items.add(orderitem1);
			items.add(orderitem2);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));

			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
			// 校验优惠券使用
			// 优惠券使用后次数
			List<YmtCouponPrivateUserBound> listCoupon3 = ymtCouponPrivateUserBoundWapper
					.selectBysCouponCode(couponCode);
			int ymtAfterCount = listCoupon3.get(0).getiCouponUsedCount();
			Logger.verifyEquals(1, (ymtBeforeCount - ymtAfterCount),
					"验证ymt平台优惠券：" + couponCode + "已使用一次");
			List<YmtCouponPrivateUserBound> listCoupon4 = ymtCouponPrivateUserBoundWapper
					.selectBysCouponCode(sellerCouponCode);
			int sellerAfterCount = listCoupon4.get(0).getiCouponUsedCount();
			Logger.verifyEquals(1, (sellerBeforeCount - sellerAfterCount),
					"验证商家优惠券：" + sellerCouponCode + "已使用一次");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_005() {
		Logger.start(true, "创建一个混合订单(一个M,一个C生成2个订单号)");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			placeorderBean.setYmatouCoupon(null);

			int userId = placeorderBean.getUserId();

			placeorderBean.getOrderGroups().get(0).setSellerCoupon(null);

			OrderVo orderVo1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0);

			orderVo1.setOrderType(OrderTypeEnum.Spot);

			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			orderVo2.setOrderType(OrderTypeEnum.Shangou);

			placeorderBean.getOrderGroups().get(0).getOrders().add(orderVo2);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_006() {
		Logger.start(true, "创建订单,使用不存在的优惠券");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			int userId = placeorderBean.getUserId();

			OrderVo orderVo1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0);

			orderVo1.setOrderType(OrderTypeEnum.Spot);

			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			orderVo2.setOrderType(OrderTypeEnum.Shangou);

			placeorderBean.getOrderGroups().get(0).getOrders().add(orderVo2);

			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = "abcdes";

			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);

			placeorderBean.setYmatouCoupon(ymtCoupon);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals(ECode.ErrCouponNotMatch,
					placeorderCall.getString("bcode"), "验证bcode");
			Logger.verifyEquals("此优惠券无效", placeorderCall.getString("msg"),
					"验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_007() {
		Logger.start(true, "创建订单,使用优惠券,优惠券金额为0");
		try {
			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			int userId = placeorderBean.getUserId();

			OrderVo orderVo1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0);

			orderVo1.setOrderType(OrderTypeEnum.Spot);

			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			orderVo2.setOrderType(OrderTypeEnum.Shangou);

			placeorderBean.getOrderGroups().get(0).getOrders().add(orderVo2);

			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);

			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(BigDecimal.ZERO);

			placeorderBean.setYmatouCoupon(ymtCoupon);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					"ymatouCoupon.couponValue:must be greater than or equal to 0.01",
					placeorderCall.getString("msg"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_008() {
		Logger.start(true, "创建订单,使用优惠券,优惠券金额大于订单金额");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(100);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals("待分摊金额过大，无法按分摊比例及最大值限制分摊",
					placeorderCall.getString("msg"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_009() {
		Logger.start(false, "创建订单,下单使用优惠券超过最大使用次数");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(15);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(10);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(100);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			placeorderCall.callService();
			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("112", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals("此优惠券使用次数超过上限",
					placeorderCall.getString("msg"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_010() {
		Logger.start(false, "创建订单,用户ID为空");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			// placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(100);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals("userId:买家用户ID未提供",
					placeorderCall.getString("msg"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_011() {
		Logger.start(false, "创建订单,订单信息为空");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(100);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			// placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals("orderGroups:订单买手组为空",
					placeorderCall.getString("msg"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_012() {
		Logger.start(false, "创建订单,商家ID为空");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			// groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(100);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals("orderGroups[0].sellerId:卖家用户ID未提供",
					placeorderCall.getString("msg"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_013() {
		Logger.start(false, "创建订单,商品价格为0");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(3);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(BigDecimal.ZERO);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					true,
					placeorderCall
							.getString("msg")
							.contains(
									"productPrice:must be greater than or equal to 0.01"),
					"验证msg包含:productPrice:must be greater than or equal to 0.01");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_014() {
		Logger.start(false, "创建订单,商品价格小于0");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(-1);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					true,
					placeorderCall
							.getString("msg")
							.contains(
									"productPrice:must be greater than or equal to 0.01"),
					"验证msg包含:productPrice:must be greater than or equal to 0.01");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_015() {
		Logger.start(false, "创建订单,商品定金价格小于0");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(10);
			orderitem1.setEarnestPrice(price.subtract(new BigDecimal(11)));
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					true,
					placeorderCall
							.getString("msg")
							.contains(
									"earnestPrice:must be greater than or equal to 0.01"),
					"验证msg包含:earnestPrice:must be greater than or equal to 0.01");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_016() {
		Logger.start(false, "创建订单,商品数量为0");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(0);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(10);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					true,
					placeorderCall.getString("msg").contains(
							"productNum:must be greater than or equal to 1"),
					"验证msg包含:productNum:must be greater than or equal to 1");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_017() {
		Logger.start(false, "创建订单,商品数量小于0");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(-2);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(10);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					true,
					placeorderCall.getString("msg").contains(
							"productNum:must be greater than or equal to 1"),
					"验证msg包含:productNum:must be greater than or equal to 1");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_018() {
		Logger.start(false, "创建订单,自动取消订单时间为0,AutoCancelOrderHours=0");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(BigDecimal.ZERO);
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(3);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(10);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					true,
					placeorderCall
							.getString("msg")
							.contains(
									"autoCancelOrderHours:must be greater than or equal to 0.01"),
					"验证msg包含:autoCancelOrderHours:must be greater than or equal to 0.01");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_019() {
		Logger.start(false, "创建订单,自动取消订单时间小于0");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(-1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(3);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(10);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					true,
					placeorderCall
							.getString("msg")
							.contains(
									"autoCancelOrderHours:must be greater than or equal to 0.01"),
					"验证msg包含:autoCancelOrderHours:must be greater than or equal to 0.01");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_020() {
		Logger.start(false, "创建订单,自动取消订单时间为null");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(90);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(60);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			// ordervo1.setAutoCancelOrderHours(new BigDecimal(-1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(3);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(10);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("11"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);
			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals(
					true,
					placeorderCall.getString("msg").contains(
							"autoCancelOrderHours:may not be null"),
					"验证msg包含:autoCancelOrderHours:may not be null");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_021() {
		Logger.start(true, "一次下单,2个买手,多个订单,分别同时使用平台,商家优惠券");

		try {

			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));

			// 创建产品
			Logger.comment("前置数据准备");

			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);

			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");

			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo seller1 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(16);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, sellerCouponValue);

			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			seller1.setSellerCoupon(sellerCoupon);
			seller1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> seller1orderList = new ArrayList<OrderVo>();
			// 订单1
			OrderVo seller1ordervo1 = new OrderVo();
			seller1ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo1.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo1.setPaidFull(true);
			seller1ordervo1.setAddress("上海市闸北区灵石路636号");
			seller1ordervo1.setLeaveWord("ymt autotest");
			seller1ordervo1.setPhone("13100000001");
			seller1ordervo1.setPostCode("200001");
			seller1ordervo1.setTelephone("021-51002100");
			seller1ordervo1.setReceiveName("李四aaa");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo1ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 2;
			seller1ordervo1Item1.setProductNum(productNum1);
			seller1ordervo1Item1.setProductName(productName);
			seller1ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item1.setProductId(productId);
			BigDecimal price1 = new BigDecimal(210);
			seller1ordervo1Item1.setFirstCategoryId(1111);
			seller1ordervo1Item1.setSecondCategoryId(2222);
			seller1ordervo1Item1.setThirdCategoryId(3333);
			seller1ordervo1Item1.setSku("1234567");
			seller1ordervo1Item1.setEarnestPrice(price1
					.subtract(new BigDecimal(160)));
			seller1ordervo1Item1.setProductPrice(price1);
			seller1ordervo1Item1.setOriginalPrice(price1);
			seller1ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item1.setFirstCategoryId(111111111);
			seller1ordervo1Item1.setSecondCategoryId(22222222);
			seller1ordervo1Item1.setThirdCategoryId(3333333);
			// 订单下面的商品2
			OrderItemVo seller1ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 2;
			seller1ordervo1Item2.setProductNum(productNum1);
			seller1ordervo1Item2.setProductName(productName);
			seller1ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item2.setProductId(productId);
			price1 = new BigDecimal(230);
			seller1ordervo1Item2.setEarnestPrice(price1);
			seller1ordervo1Item2.setProductPrice(price1);
			seller1ordervo1Item2.setOriginalPrice(price1);
			seller1ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item2
					.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			seller1ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item2.setFirstCategoryId(111111111);
			seller1ordervo1Item2.setSecondCategoryId(22222222);
			seller1ordervo1Item2.setThirdCategoryId(3333333);
			// 订单下面的商品3
			OrderItemVo seller1ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 4;
			seller1ordervo1Item3.setProductNum(productNum1);
			seller1ordervo1Item3.setProductName(productName);
			seller1ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item3.setProductId(productId);
			price1 = new BigDecimal(270);
			seller1ordervo1Item3.setEarnestPrice(price1);
			seller1ordervo1Item3.setProductPrice(price1);
			seller1ordervo1Item3.setOriginalPrice(price1);
			seller1ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			seller1ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item3.setFirstCategoryId(111111111);
			seller1ordervo1Item3.setSecondCategoryId(22222222);
			seller1ordervo1Item3.setThirdCategoryId(3333333);
			// 商品1
			seller1ordervo1ItemList1.add(seller1ordervo1Item1);
			// 商品2
			seller1ordervo1ItemList1.add(seller1ordervo1Item2);
			// 商品3
			seller1ordervo1ItemList1.add(seller1ordervo1Item3);
			// 订单1 的3个商品
			seller1ordervo1.setOrderItems(seller1ordervo1ItemList1);
			seller1ordervo1.setFreight(new BigDecimal("140"));

			// 订单2
			OrderVo seller1ordervo2 = new OrderVo();
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Spot);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAddress("上海市闸北区灵石路636号");
			seller1ordervo2.setLeaveWord("ymt autotest");
			seller1ordervo2.setPhone("13100000001");
			seller1ordervo2.setPostCode("200001");
			seller1ordervo2.setTelephone("021-51002100");
			seller1ordervo2.setReceiveName("李四");

			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo2ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo2Item2 = new OrderItemVo();
			seller1ordervo2Item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 4;
			seller1ordervo2Item2.setProductNum(productNum);
			seller1ordervo2Item2.setProductName(productName);
			seller1ordervo2Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo2Item2.setProductId(productId);
			BigDecimal price = new BigDecimal(160);
			seller1ordervo2Item2.setEarnestPrice(price);
			seller1ordervo2Item2.setProductPrice(price);
			seller1ordervo2Item2.setOriginalPrice(price);
			seller1ordervo2Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo2Item2
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo2Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo2Item2.setFirstCategoryId(111111111);
			seller1ordervo2Item2.setSecondCategoryId(22222222);
			seller1ordervo2Item2.setThirdCategoryId(3333333);
			seller1ordervo2ItemList1.add(seller1ordervo2Item2);
			seller1ordervo2.setOrderItems(seller1ordervo2ItemList1);
			seller1ordervo2.setFreight(new BigDecimal("45"));

			seller1orderList.add(seller1ordervo1);
			seller1orderList.add(seller1ordervo2);
			// orders.add(ordervo2);
			seller1.setOrders(seller1orderList);

			// 买手2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));

			OrderGroupVo seller2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId2, userId, sellerCouponValue2);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			seller2.setSellerCoupon(sellerCoupon2);

			seller2.setSellerId(sellerId2);

			List<OrderVo> sellerId2ordersList1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");
			// 定义买手下订单列表
			List<OrderItemVo> sellerId2ItemsList1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Order1Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Order1Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 4;
			sellerId2Order1Item1.setProductNum(productNum2);
			sellerId2Order1Item1.setProductName(productName);
			sellerId2Order1Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Order1Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Order1Item1.setEarnestPrice(price2);
			sellerId2Order1Item1.setProductPrice(price2);
			sellerId2Order1Item1.setOriginalPrice(price2);
			sellerId2Order1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Order1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Order1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Order1Item1.setFirstCategoryId(111111111);
			sellerId2Order1Item1.setSecondCategoryId(22222222);
			sellerId2Order1Item1.setThirdCategoryId(3333333);
			sellerId2ItemsList1.add(sellerId2Order1Item1);

			sellerId2order1.setOrderItems(sellerId2ItemsList1);
			sellerId2order1.setFreight(new BigDecimal("55"));

			sellerId2ordersList1.add(sellerId2order1);
			seller2.setOrders(sellerId2ordersList1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(seller1);
			orderGroupVos.add(seller2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
			verifyBaseInfo();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_022() {
		Logger.start(true, "一次下单,多个商品,其中有商品不适用商家优惠券,校验商家优惠券分摊逻辑");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo seller1 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon
					.setApplianceType(SellerCouponApplianceTypeEnum.SPEC_RODUCT);
			// 指定aaaa 商品能用商家优惠券
			sellerCoupon.setApplianceTargets(Arrays.asList("aaaa"));
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			seller1.setSellerCoupon(sellerCoupon);
			seller1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> seller1orderList = new ArrayList<OrderVo>();
			// 订单1
			OrderVo seller1ordervo1 = new OrderVo();
			seller1ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo1.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo1.setPaidFull(true);
			seller1ordervo1.setAddress("上海市闸北区灵石路636号");
			seller1ordervo1.setLeaveWord("ymt autotest");
			seller1ordervo1.setPhone("13100000001");
			seller1ordervo1.setPostCode("200001");
			seller1ordervo1.setTelephone("021-51002100");
			seller1ordervo1.setReceiveName("李四aaaa");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo1ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 2;
			seller1ordervo1Item1.setProductNum(productNum1);
			seller1ordervo1Item1.setProductName(productName);
			seller1ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item1.setProductId("aaaa");
			BigDecimal price1 = new BigDecimal(210);
			seller1ordervo1Item1.setFirstCategoryId(1111);
			seller1ordervo1Item1.setSecondCategoryId(2222);
			seller1ordervo1Item1.setThirdCategoryId(3333);
			seller1ordervo1Item1.setSku("1234567");
			seller1ordervo1Item1.setEarnestPrice(price1
					.subtract(new BigDecimal(160)));
			seller1ordervo1Item1.setProductPrice(price1);
			seller1ordervo1Item1.setOriginalPrice(price1);
			seller1ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item1.setFirstCategoryId(111111111);
			seller1ordervo1Item1.setSecondCategoryId(22222222);
			seller1ordervo1Item1.setThirdCategoryId(3333333);
			// 订单下面的商品2
			OrderItemVo seller1ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 2;
			seller1ordervo1Item2.setProductNum(productNum1);
			seller1ordervo1Item2.setProductName(productName);
			seller1ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item2.setProductId(productId);
			price1 = new BigDecimal(230);
			seller1ordervo1Item2.setEarnestPrice(price1);
			seller1ordervo1Item2.setProductPrice(price1);
			seller1ordervo1Item2.setOriginalPrice(price1);
			seller1ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item2
					.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			seller1ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item2.setFirstCategoryId(111111111);
			seller1ordervo1Item2.setSecondCategoryId(22222222);
			seller1ordervo1Item2.setThirdCategoryId(3333333);
			// 订单下面的商品3
			OrderItemVo seller1ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 4;
			seller1ordervo1Item3.setProductNum(productNum1);
			seller1ordervo1Item3.setProductName(productName);
			seller1ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item3.setProductId(productId);
			price1 = new BigDecimal(270);
			seller1ordervo1Item3.setEarnestPrice(price1);
			seller1ordervo1Item3.setProductPrice(price1);
			seller1ordervo1Item3.setOriginalPrice(price1);
			seller1ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			seller1ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item3.setFirstCategoryId(111111111);
			seller1ordervo1Item3.setSecondCategoryId(22222222);
			seller1ordervo1Item3.setThirdCategoryId(3333333);
			// 商品1
			seller1ordervo1ItemList1.add(seller1ordervo1Item1);
			// 商品2
			seller1ordervo1ItemList1.add(seller1ordervo1Item2);
			// 商品3
			seller1ordervo1ItemList1.add(seller1ordervo1Item3);
			// 订单1 的3个商品
			seller1ordervo1.setOrderItems(seller1ordervo1ItemList1);
			seller1ordervo1.setFreight(new BigDecimal("140"));

			// 订单2
			OrderVo seller1ordervo2 = new OrderVo();
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Spot);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAddress("上海市闸北区灵石路636号");
			seller1ordervo2.setLeaveWord("ymt autotest");
			seller1ordervo2.setPhone("13100000001");
			seller1ordervo2.setPostCode("200001");
			seller1ordervo2.setTelephone("021-51002100");
			seller1ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo2ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo2Item2 = new OrderItemVo();
			seller1ordervo2Item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 4;
			seller1ordervo2Item2.setProductNum(productNum);
			seller1ordervo2Item2.setProductName(productName);
			seller1ordervo2Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo2Item2.setProductId(productId);
			BigDecimal price = new BigDecimal(160);
			seller1ordervo2Item2.setEarnestPrice(price);
			seller1ordervo2Item2.setProductPrice(price);
			seller1ordervo2Item2.setOriginalPrice(price);
			seller1ordervo2Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo2Item2
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo2Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo2Item2.setFirstCategoryId(111111111);
			seller1ordervo2Item2.setSecondCategoryId(22222222);
			seller1ordervo2Item2.setThirdCategoryId(3333333);
			seller1ordervo2ItemList1.add(seller1ordervo2Item2);
			seller1ordervo2.setOrderItems(seller1ordervo2ItemList1);
			seller1ordervo2.setFreight(new BigDecimal("45"));

			seller1orderList.add(seller1ordervo1);
			seller1orderList.add(seller1ordervo2);
			// orders.add(ordervo2);
			seller1.setOrders(seller1orderList);

			// 买手2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			OrderGroupVo seller2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId2, userId, sellerCouponValue2);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			seller2.setSellerCoupon(sellerCoupon2);
			// 卖家2
			// int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			seller2.setSellerId(sellerId2);

			List<OrderVo> sellerId2ordersList1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");
			// 定义买手下订单列表
			List<OrderItemVo> sellerId2ItemsList1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Order1Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Order1Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 4;
			sellerId2Order1Item1.setProductNum(productNum2);
			sellerId2Order1Item1.setProductName(productName);
			sellerId2Order1Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Order1Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Order1Item1.setEarnestPrice(price2);
			sellerId2Order1Item1.setProductPrice(price2);
			sellerId2Order1Item1.setOriginalPrice(price2);
			sellerId2Order1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Order1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Order1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Order1Item1.setFirstCategoryId(111111111);
			sellerId2Order1Item1.setSecondCategoryId(22222222);
			sellerId2Order1Item1.setThirdCategoryId(3333333);
			sellerId2ItemsList1.add(sellerId2Order1Item1);

			sellerId2order1.setOrderItems(sellerId2ItemsList1);
			sellerId2order1.setFreight(new BigDecimal("55"));

			sellerId2ordersList1.add(sellerId2order1);
			seller2.setOrders(sellerId2ordersList1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(seller1);
			orderGroupVos.add(seller2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_023() {
		Logger.start(true, "一次下单,多个商品,其中有商品不适用平台优惠卷,校验平台优惠券分摊逻辑");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon
					.setApplianceType(YmatouCouponApplianceTypeEnum.SPEC_RODUCT);
			ymtCoupon.setApplianceTargets(Arrays.asList("aaaa"));
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo seller1 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			seller1.setSellerCoupon(sellerCoupon);
			seller1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> seller1orderList = new ArrayList<OrderVo>();
			// 订单1
			OrderVo seller1ordervo1 = new OrderVo();
			seller1ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo1.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo1.setPaidFull(true);
			seller1ordervo1.setAddress("上海市闸北区灵石路636号");
			seller1ordervo1.setLeaveWord("ymt autotest");
			seller1ordervo1.setPhone("13100000001");
			seller1ordervo1.setPostCode("200001");
			seller1ordervo1.setTelephone("021-51002100");
			seller1ordervo1.setReceiveName("李四aaa");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo1ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 2;
			seller1ordervo1Item1.setProductNum(productNum1);
			seller1ordervo1Item1.setProductName(productName);
			seller1ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item1.setProductId("aaaa");
			BigDecimal price1 = new BigDecimal(210);
			seller1ordervo1Item1.setFirstCategoryId(1111);
			seller1ordervo1Item1.setSecondCategoryId(2222);
			seller1ordervo1Item1.setThirdCategoryId(3333);
			seller1ordervo1Item1.setSku("1234567");
			seller1ordervo1Item1.setEarnestPrice(price1
					.subtract(new BigDecimal(160)));
			seller1ordervo1Item1.setProductPrice(price1);
			seller1ordervo1Item1.setOriginalPrice(price1);
			seller1ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item1.setFirstCategoryId(111111111);
			seller1ordervo1Item1.setSecondCategoryId(22222222);
			seller1ordervo1Item1.setThirdCategoryId(3333333);
			// 订单下面的商品2
			OrderItemVo seller1ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 2;
			seller1ordervo1Item2.setProductNum(productNum1);
			seller1ordervo1Item2.setProductName(productName);
			seller1ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item2.setProductId(productId);
			price1 = new BigDecimal(230);
			seller1ordervo1Item2.setEarnestPrice(price1);
			seller1ordervo1Item2.setProductPrice(price1);
			seller1ordervo1Item2.setOriginalPrice(price1);
			seller1ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item2
					.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			seller1ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item2.setFirstCategoryId(111111111);
			seller1ordervo1Item2.setSecondCategoryId(22222222);
			seller1ordervo1Item2.setThirdCategoryId(3333333);
			// 订单下面的商品3
			OrderItemVo seller1ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 4;
			seller1ordervo1Item3.setProductNum(productNum1);
			seller1ordervo1Item3.setProductName(productName);
			seller1ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item3.setProductId(productId);
			price1 = new BigDecimal(270);
			seller1ordervo1Item3.setEarnestPrice(price1);
			seller1ordervo1Item3.setProductPrice(price1);
			seller1ordervo1Item3.setOriginalPrice(price1);
			seller1ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			seller1ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item3.setFirstCategoryId(111111111);
			seller1ordervo1Item3.setSecondCategoryId(22222222);
			seller1ordervo1Item3.setThirdCategoryId(3333333);
			// 商品1
			seller1ordervo1ItemList1.add(seller1ordervo1Item1);
			// 商品2
			seller1ordervo1ItemList1.add(seller1ordervo1Item2);
			// 商品3
			seller1ordervo1ItemList1.add(seller1ordervo1Item3);
			// 订单1 的3个商品
			seller1ordervo1.setOrderItems(seller1ordervo1ItemList1);
			seller1ordervo1.setFreight(new BigDecimal("140"));

			// 订单2
			OrderVo seller1ordervo2 = new OrderVo();
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Spot);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAddress("上海市闸北区灵石路636号");
			seller1ordervo2.setLeaveWord("ymt autotest");
			seller1ordervo2.setPhone("13100000001");
			seller1ordervo2.setPostCode("200001");
			seller1ordervo2.setTelephone("021-51002100");
			seller1ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo2ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo2Item2 = new OrderItemVo();
			seller1ordervo2Item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 4;
			seller1ordervo2Item2.setProductNum(productNum);
			seller1ordervo2Item2.setProductName(productName);
			seller1ordervo2Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo2Item2.setProductId(productId);
			BigDecimal price = new BigDecimal(160);
			seller1ordervo2Item2.setEarnestPrice(price);
			seller1ordervo2Item2.setProductPrice(price);
			seller1ordervo2Item2.setOriginalPrice(price);
			seller1ordervo2Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo2Item2
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo2Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo2Item2.setFirstCategoryId(111111111);
			seller1ordervo2Item2.setSecondCategoryId(22222222);
			seller1ordervo2Item2.setThirdCategoryId(3333333);
			seller1ordervo2ItemList1.add(seller1ordervo2Item2);
			seller1ordervo2.setOrderItems(seller1ordervo2ItemList1);
			seller1ordervo2.setFreight(new BigDecimal("45"));

			seller1orderList.add(seller1ordervo1);
			seller1orderList.add(seller1ordervo2);
			// orders.add(ordervo2);
			seller1.setOrders(seller1orderList);
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			// 买手2
			OrderGroupVo seller2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId2, userId, sellerCouponValue2);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			seller2.setSellerCoupon(sellerCoupon2);

			seller2.setSellerId(sellerId2);

			List<OrderVo> sellerId2ordersList1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");
			// 定义买手下订单列表
			List<OrderItemVo> sellerId2ItemsList1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Order1Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Order1Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 4;
			sellerId2Order1Item1.setProductNum(productNum2);
			sellerId2Order1Item1.setProductName(productName);
			sellerId2Order1Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Order1Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Order1Item1.setEarnestPrice(price2);
			sellerId2Order1Item1.setProductPrice(price2);
			sellerId2Order1Item1.setOriginalPrice(price2);
			sellerId2Order1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Order1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Order1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Order1Item1.setFirstCategoryId(111111111);
			sellerId2Order1Item1.setSecondCategoryId(22222222);
			sellerId2Order1Item1.setThirdCategoryId(3333333);
			sellerId2ItemsList1.add(sellerId2Order1Item1);

			sellerId2order1.setOrderItems(sellerId2ItemsList1);
			sellerId2order1.setFreight(new BigDecimal("55"));

			sellerId2ordersList1.add(sellerId2order1);
			seller2.setOrders(sellerId2ordersList1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(seller1);
			orderGroupVos.add(seller2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_024() {
		Logger.start(true, "一次下单,多个商品,其中有商品分别不适用平台优惠卷,商家券.校验优惠券优惠券分摊逻辑");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon
					.setApplianceType(YmatouCouponApplianceTypeEnum.SPEC_RODUCT);
			ymtCoupon.setApplianceTargets(Arrays.asList("aaaa"));
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo seller1 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon
					.setApplianceType(SellerCouponApplianceTypeEnum.SPEC_RODUCT);
			sellerCoupon.setApplianceTargets(Arrays.asList("bbb"));
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			seller1.setSellerCoupon(sellerCoupon);
			seller1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> seller1orderList = new ArrayList<OrderVo>();
			// 订单1
			OrderVo seller1ordervo1 = new OrderVo();
			seller1ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo1.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo1.setPaidFull(true);
			seller1ordervo1.setAddress("上海市闸北区灵石路636号");
			seller1ordervo1.setLeaveWord("ymt autotest");
			seller1ordervo1.setPhone("13100000001");
			seller1ordervo1.setPostCode("200001");
			seller1ordervo1.setTelephone("021-51002100");
			seller1ordervo1.setReceiveName("李四aaa");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo1ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 2;
			seller1ordervo1Item1.setProductNum(productNum1);
			seller1ordervo1Item1.setProductName(productName);
			seller1ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item1.setProductId("aaaa");
			BigDecimal price1 = new BigDecimal(210);
			seller1ordervo1Item1.setFirstCategoryId(1111);
			seller1ordervo1Item1.setSecondCategoryId(2222);
			seller1ordervo1Item1.setThirdCategoryId(3333);
			seller1ordervo1Item1.setSku("1234567");
			seller1ordervo1Item1.setEarnestPrice(price1
					.subtract(new BigDecimal(160)));
			seller1ordervo1Item1.setProductPrice(price1);
			seller1ordervo1Item1.setOriginalPrice(price1);
			seller1ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item1.setFirstCategoryId(111111111);
			seller1ordervo1Item1.setSecondCategoryId(22222222);
			seller1ordervo1Item1.setThirdCategoryId(3333333);
			// 订单下面的商品2
			OrderItemVo seller1ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 2;
			seller1ordervo1Item2.setProductNum(productNum1);
			seller1ordervo1Item2.setProductName(productName);
			seller1ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item2.setProductId("bbb");
			price1 = new BigDecimal(230);
			seller1ordervo1Item2.setEarnestPrice(price1);
			seller1ordervo1Item2.setProductPrice(price1);
			seller1ordervo1Item2.setOriginalPrice(price1);
			seller1ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item2
					.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			seller1ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item2.setFirstCategoryId(111111111);
			seller1ordervo1Item2.setSecondCategoryId(22222222);
			seller1ordervo1Item2.setThirdCategoryId(3333333);
			// 订单下面的商品3
			OrderItemVo seller1ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 4;
			seller1ordervo1Item3.setProductNum(productNum1);
			seller1ordervo1Item3.setProductName(productName);
			seller1ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item3.setProductId(productId);
			price1 = new BigDecimal(270);
			seller1ordervo1Item3.setEarnestPrice(price1);
			seller1ordervo1Item3.setProductPrice(price1);
			seller1ordervo1Item3.setOriginalPrice(price1);
			seller1ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			seller1ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item3.setFirstCategoryId(111111111);
			seller1ordervo1Item3.setSecondCategoryId(22222222);
			seller1ordervo1Item3.setThirdCategoryId(3333333);
			// 商品1
			seller1ordervo1ItemList1.add(seller1ordervo1Item1);
			// 商品2
			seller1ordervo1ItemList1.add(seller1ordervo1Item2);
			// 商品3
			seller1ordervo1ItemList1.add(seller1ordervo1Item3);
			// 订单1 的3个商品
			seller1ordervo1.setOrderItems(seller1ordervo1ItemList1);
			seller1ordervo1.setFreight(new BigDecimal("140"));

			// 订单2
			OrderVo seller1ordervo2 = new OrderVo();
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Spot);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAddress("上海市闸北区灵石路636号");
			seller1ordervo2.setLeaveWord("ymt autotest");
			seller1ordervo2.setPhone("13100000001");
			seller1ordervo2.setPostCode("200001");
			seller1ordervo2.setTelephone("021-51002100");
			seller1ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo2ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo2Item2 = new OrderItemVo();
			seller1ordervo2Item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 4;
			seller1ordervo2Item2.setProductNum(productNum);
			seller1ordervo2Item2.setProductName(productName);
			seller1ordervo2Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo2Item2.setProductId(productId);
			BigDecimal price = new BigDecimal(160);
			seller1ordervo2Item2.setEarnestPrice(price);
			seller1ordervo2Item2.setProductPrice(price);
			seller1ordervo2Item2.setOriginalPrice(price);
			seller1ordervo2Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo2Item2
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo2Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo2Item2.setFirstCategoryId(111111111);
			seller1ordervo2Item2.setSecondCategoryId(22222222);
			seller1ordervo2Item2.setThirdCategoryId(3333333);
			seller1ordervo2ItemList1.add(seller1ordervo2Item2);
			seller1ordervo2.setOrderItems(seller1ordervo2ItemList1);
			seller1ordervo2.setFreight(new BigDecimal("45"));

			seller1orderList.add(seller1ordervo1);
			seller1orderList.add(seller1ordervo2);
			// orders.add(ordervo2);
			seller1.setOrders(seller1orderList);

			// 买手2
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			OrderGroupVo seller2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId2, userId, sellerCouponValue2);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			seller2.setSellerCoupon(sellerCoupon2);

			seller2.setSellerId(sellerId2);

			List<OrderVo> sellerId2ordersList1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");
			// 定义买手下订单列表
			List<OrderItemVo> sellerId2ItemsList1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Order1Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Order1Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 4;
			sellerId2Order1Item1.setProductNum(productNum2);
			sellerId2Order1Item1.setProductName(productName);
			sellerId2Order1Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Order1Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Order1Item1.setEarnestPrice(price2);
			sellerId2Order1Item1.setProductPrice(price2);
			sellerId2Order1Item1.setOriginalPrice(price2);
			sellerId2Order1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Order1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Order1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Order1Item1.setFirstCategoryId(111111111);
			sellerId2Order1Item1.setSecondCategoryId(22222222);
			sellerId2Order1Item1.setThirdCategoryId(3333333);
			sellerId2ItemsList1.add(sellerId2Order1Item1);

			sellerId2order1.setOrderItems(sellerId2ItemsList1);
			sellerId2order1.setFreight(new BigDecimal("55"));

			sellerId2ordersList1.add(sellerId2order1);
			seller2.setOrders(sellerId2ordersList1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(seller1);
			orderGroupVos.add(seller2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	// @Ignore
	// 手工校验，使用的补贴商品，发送总线消息
	public void Tc_PlaceOrder_025() {
		Logger.start(true, "使用的补贴商品，商品补贴消息");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = 3383;
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);

			List<YmtCouponPrivateUserBound> listCoupon = new YmtCouponPrivateUserBoundWapper()
					.selectBysCouponCode(couponCode);
			int beforeCount = listCoupon.get(0).getiCouponUsedCount();
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			// placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			placeorderBean.setSourceIp("127.0.0.1");
			placeorderBean.setAppId("ios");
			placeorderBean.setDeviceId("7777777777888888888888999");
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.PC);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Spot);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setCatalogId("03c5516e-8a3c-451a-8d6c-09c8848d39d9");
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId("7d2233e7-30b3-4366-8918-12623accf429");
			price = new BigDecimal(210);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			ActivityVo activity = new ActivityVo();
			activity.setActivityId(18830);
			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);
			orderitem1.setActivity(activity);
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);
			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			// verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	@Ignore
	// 手工校验，发送校验身份证是否上传总线消息
	public void Tc_PlaceOrder_026() {
		Logger.start(true, "创建订单,使用贝海直邮，发送校验身份证是否上传总线消息");
		try {
			// int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int userId = 4085;
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// int sellerId = 20225392;
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// BigDecimal price = (BigDecimal) (productInfo.get("price"));
			// String catalogId = (String) productInfo.get("catalogId");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo groupVo1 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			List<String> applianceTargets = new ArrayList<String>();
			// applianceTargets.add("彭志邦");
			// sellerCoupon.setApplianceTargets(applianceTargets);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> orders = new ArrayList<OrderVo>();
			// 订单1
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13818634280");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("彭志邦");
			// 定义买手下订单下商品
			List<OrderItemVo> ordervo1Items1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item1.setProductNum(productNum1);
			ordervo1Item1.setProductName(productName);
			ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item1.setProductId("aaabbb");
			BigDecimal price1 = new BigDecimal(210);
			ordervo1Item1.setFirstCategoryId(1111);
			ordervo1Item1.setSecondCategoryId(2222);
			ordervo1Item1.setThirdCategoryId(3333);
			ordervo1Item1.setSku("1234567");
			ordervo1Item1.setEarnestPrice(price1.subtract(new BigDecimal(160)));
			ordervo1Item1.setProductPrice(price1);
			ordervo1Item1.setOriginalPrice(price1);
			ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);

			// 订单下面的商品2
			OrderItemVo ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item2.setProductNum(productNum1);
			ordervo1Item2.setProductName(productName);
			ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item2.setProductId(productId);
			price1 = new BigDecimal(230);
			ordervo1Item2.setEarnestPrice(price1);
			ordervo1Item2.setProductPrice(price1);
			ordervo1Item2.setOriginalPrice(price1);
			ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item2.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			// 订单下面的商品3
			OrderItemVo ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item3.setProductNum(productNum1);
			ordervo1Item3.setProductName(productName);
			ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item3.setProductId(productId);
			price1 = new BigDecimal(230);
			ordervo1Item3.setEarnestPrice(price1);
			ordervo1Item3.setProductPrice(price1);
			ordervo1Item3.setOriginalPrice(price1);
			ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			// 商品1
			ordervo1Items1.add(ordervo1Item1);
			// 商品2
			ordervo1Items1.add(ordervo1Item2);
			// 商品3
			ordervo1Items1.add(ordervo1Item3);
			// 订单1 的3个商品
			ordervo1.setOrderItems(ordervo1Items1);
			ordervo1.setFreight(new BigDecimal("135"));

			// 订单2
			OrderVo ordervo2 = new OrderVo();
			ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo2.setOrderType(OrderTypeEnum.Spot);
			ordervo2.setPaidFull(true);
			ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo2.setOrderType(OrderTypeEnum.Shangou);
			ordervo2.setPaidFull(true);
			ordervo2.setAddress("上海市闸北区灵石路636号");
			ordervo2.setLeaveWord("ymt autotest");
			ordervo2.setPhone("13100000001");
			ordervo2.setPostCode("200001");
			ordervo2.setTelephone("021-51002100");
			ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> ordervo2items2 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo ordervo2item2 = new OrderItemVo();
			ordervo2item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 1 + new Random().nextInt(5);
			ordervo2item2.setProductNum(productNum);
			ordervo2item2.setProductName(productName);
			ordervo2item2.setPriceType(PriceTypeEnum.VipPrice);
			ordervo2item2.setProductId(productId);
			BigDecimal price = new BigDecimal(260);
			ordervo2item2.setEarnestPrice(price);
			ordervo2item2.setProductPrice(price);
			ordervo2item2.setOriginalPrice(price);
			ordervo2item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo2item2.setLogisticsType(LogisticsTypeEnum.SailProtect);
			ordervo2item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			ordervo2items2.add(ordervo2item2);
			ordervo2.setOrderItems(ordervo2items2);
			ordervo2.setFreight(new BigDecimal("45"));

			orders.add(ordervo1);
			// orders.add(ordervo2);
			// orders.add(ordervo2);
			groupVo1.setOrders(orders);

			// 买手2
			OrderGroupVo groupVo2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			groupVo2.setSellerCoupon(sellerCoupon2);
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			groupVo2.setSellerId(sellerId2);
			List<OrderVo> sellerId2orders1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");

			// 定义买手下订单列表
			List<OrderItemVo> sellerId2Items1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 1 + new Random().nextInt(5);
			sellerId2Item1.setProductNum(productNum2);
			sellerId2Item1.setProductName(productName);
			sellerId2Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Item1.setEarnestPrice(price2);
			sellerId2Item1.setProductPrice(price2);
			sellerId2Item1.setOriginalPrice(price2);
			sellerId2Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Item1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Items1.add(sellerId2Item1);
			ordervo2.setOrderItems(sellerId2Items1);
			ordervo2.setFreight(new BigDecimal("45"));
			sellerId2orders1.add(ordervo2);
			groupVo2.setOrders(sellerId2orders1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(groupVo1);
			// orderGroupVos.add(groupVo2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			// verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_028() {
		Logger.start(true, "重复请求处理，同一个requestid 重复请求");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			// placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			// groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(210);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			// placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("197", placeorderCall.getString("bcode"),
					"验证Code");
			Logger.verifyEquals("重复的下单请求:" + placeorderBean.getRequestId(),
					placeorderCall.getString("msg"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	@Ignore
	// 手工校验，使用了平台优惠券发送分控消息
	public void Tc_PlaceOrder_029() {
		Logger.start(true, "创建订单,使用了平台优惠券发送分控消息");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// int sellerId = 20225392;
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// BigDecimal price = (BigDecimal) (productInfo.get("price"));
			// String catalogId = (String) productInfo.get("catalogId");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo groupVo1 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon
					.setApplianceType(SellerCouponApplianceTypeEnum.SPEC_RODUCT);
			List<String> applianceTargets = new ArrayList<String>();
			applianceTargets.add("aaabbb");
			sellerCoupon.setApplianceTargets(applianceTargets);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> orders = new ArrayList<OrderVo>();
			// 订单1
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> ordervo1Items1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item1.setProductNum(productNum1);
			ordervo1Item1.setProductName(productName);
			ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item1.setProductId("aaabbb");
			BigDecimal price1 = new BigDecimal(210);
			ordervo1Item1.setFirstCategoryId(1111);
			ordervo1Item1.setSecondCategoryId(2222);
			ordervo1Item1.setThirdCategoryId(3333);
			ordervo1Item1.setSku("1234567");
			ordervo1Item1.setEarnestPrice(price1.subtract(new BigDecimal(160)));
			ordervo1Item1.setProductPrice(price1);
			ordervo1Item1.setOriginalPrice(price1);
			ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);

			// 订单下面的商品2
			OrderItemVo ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item2.setProductNum(productNum1);
			ordervo1Item2.setProductName(productName);
			ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item2.setProductId(productId);
			price1 = new BigDecimal(230);
			ordervo1Item2.setEarnestPrice(price1);
			ordervo1Item2.setProductPrice(price1);
			ordervo1Item2.setOriginalPrice(price1);
			ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item2.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			// 订单下面的商品3
			OrderItemVo ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item3.setProductNum(productNum1);
			ordervo1Item3.setProductName(productName);
			ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item3.setProductId(productId);
			price1 = new BigDecimal(230);
			ordervo1Item3.setEarnestPrice(price1);
			ordervo1Item3.setProductPrice(price1);
			ordervo1Item3.setOriginalPrice(price1);
			ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			// 商品1
			ordervo1Items1.add(ordervo1Item1);
			// 商品2
			ordervo1Items1.add(ordervo1Item2);
			// 商品3
			ordervo1Items1.add(ordervo1Item3);
			// 订单1 的3个商品
			ordervo1.setOrderItems(ordervo1Items1);
			ordervo1.setFreight(new BigDecimal("135"));

			// 订单2
			OrderVo ordervo2 = new OrderVo();
			ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo2.setOrderType(OrderTypeEnum.Spot);
			ordervo2.setPaidFull(true);
			ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo2.setOrderType(OrderTypeEnum.Shangou);
			ordervo2.setPaidFull(true);
			ordervo2.setAddress("上海市闸北区灵石路636号");
			ordervo2.setLeaveWord("ymt autotest");
			ordervo2.setPhone("13100000001");
			ordervo2.setPostCode("200001");
			ordervo2.setTelephone("021-51002100");
			ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> ordervo2items2 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo ordervo2item2 = new OrderItemVo();
			ordervo2item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 1 + new Random().nextInt(5);
			ordervo2item2.setProductNum(productNum);
			ordervo2item2.setProductName(productName);
			ordervo2item2.setPriceType(PriceTypeEnum.VipPrice);
			ordervo2item2.setProductId(productId);
			BigDecimal price = new BigDecimal(260);
			ordervo2item2.setEarnestPrice(price);
			ordervo2item2.setProductPrice(price);
			ordervo2item2.setOriginalPrice(price);
			ordervo2item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo2item2.setLogisticsType(LogisticsTypeEnum.SailProtect);
			ordervo2item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			ordervo2items2.add(ordervo2item2);
			ordervo2.setOrderItems(ordervo2items2);
			ordervo2.setFreight(new BigDecimal("45"));

			orders.add(ordervo1);
			orders.add(ordervo2);
			orders.add(ordervo2);
			groupVo1.setOrders(orders);

			// 买手2
			OrderGroupVo groupVo2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			groupVo2.setSellerCoupon(sellerCoupon2);
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			groupVo2.setSellerId(sellerId2);
			List<OrderVo> sellerId2orders1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");

			// 定义买手下订单列表
			List<OrderItemVo> sellerId2Items1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 1 + new Random().nextInt(5);
			sellerId2Item1.setProductNum(productNum2);
			sellerId2Item1.setProductName(productName);
			sellerId2Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Item1.setEarnestPrice(price2);
			sellerId2Item1.setProductPrice(price2);
			sellerId2Item1.setOriginalPrice(price2);
			sellerId2Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Item1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Items1.add(sellerId2Item1);
			ordervo2.setOrderItems(sellerId2Items1);
			ordervo2.setFreight(new BigDecimal("45"));
			sellerId2orders1.add(ordervo2);
			groupVo2.setOrders(sellerId2orders1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(groupVo1);
			orderGroupVos.add(groupVo2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			// verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	@Ignore
	// 手工校验，使用了平台优惠券发送分控消息
	public void Tc_PlaceOrder_030() {
		Logger.start(true, "创建订单,没有使用了平台优惠券不发送分控消息");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");

			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo groupVo1 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon
					.setApplianceType(SellerCouponApplianceTypeEnum.SPEC_RODUCT);
			List<String> applianceTargets = new ArrayList<String>();
			applianceTargets.add("aaabbb");
			sellerCoupon.setApplianceTargets(applianceTargets);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> orders = new ArrayList<OrderVo>();
			// 订单1
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Shangou);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> ordervo1Items1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item1.setProductNum(productNum1);
			ordervo1Item1.setProductName(productName);
			ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item1.setProductId("aaabbb");
			BigDecimal price1 = new BigDecimal(210);
			ordervo1Item1.setFirstCategoryId(1111);
			ordervo1Item1.setSecondCategoryId(2222);
			ordervo1Item1.setThirdCategoryId(3333);
			ordervo1Item1.setSku("1234567");
			ordervo1Item1.setEarnestPrice(price1.subtract(new BigDecimal(160)));
			ordervo1Item1.setProductPrice(price1);
			ordervo1Item1.setOriginalPrice(price1);
			ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);

			// 订单下面的商品2
			OrderItemVo ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item2.setProductNum(productNum1);
			ordervo1Item2.setProductName(productName);
			ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item2.setProductId(productId);
			price1 = new BigDecimal(230);
			ordervo1Item2.setEarnestPrice(price1);
			ordervo1Item2.setProductPrice(price1);
			ordervo1Item2.setOriginalPrice(price1);
			ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item2.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			// 订单下面的商品3
			OrderItemVo ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 1 + new Random().nextInt(5);
			ordervo1Item3.setProductNum(productNum1);
			ordervo1Item3.setProductName(productName);
			ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			ordervo1Item3.setProductId(productId);
			price1 = new BigDecimal(230);
			ordervo1Item3.setEarnestPrice(price1);
			ordervo1Item3.setProductPrice(price1);
			ordervo1Item3.setOriginalPrice(price1);
			ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			// 商品1
			ordervo1Items1.add(ordervo1Item1);
			// 商品2
			ordervo1Items1.add(ordervo1Item2);
			// 商品3
			ordervo1Items1.add(ordervo1Item3);
			// 订单1 的3个商品
			ordervo1.setOrderItems(ordervo1Items1);
			ordervo1.setFreight(new BigDecimal("135"));

			// 订单2
			OrderVo ordervo2 = new OrderVo();
			ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo2.setOrderType(OrderTypeEnum.Spot);
			ordervo2.setPaidFull(true);
			ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo2.setOrderType(OrderTypeEnum.Shangou);
			ordervo2.setPaidFull(true);
			ordervo2.setAddress("上海市闸北区灵石路636号");
			ordervo2.setLeaveWord("ymt autotest");
			ordervo2.setPhone("13100000001");
			ordervo2.setPostCode("200001");
			ordervo2.setTelephone("021-51002100");
			ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> ordervo2items2 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo ordervo2item2 = new OrderItemVo();
			ordervo2item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 1 + new Random().nextInt(5);
			ordervo2item2.setProductNum(productNum);
			ordervo2item2.setProductName(productName);
			ordervo2item2.setPriceType(PriceTypeEnum.VipPrice);
			ordervo2item2.setProductId(productId);
			BigDecimal price = new BigDecimal(260);
			ordervo2item2.setEarnestPrice(price);
			ordervo2item2.setProductPrice(price);
			ordervo2item2.setOriginalPrice(price);
			ordervo2item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			ordervo2item2.setLogisticsType(LogisticsTypeEnum.SailProtect);
			ordervo2item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			ordervo2items2.add(ordervo2item2);
			ordervo2.setOrderItems(ordervo2items2);
			ordervo2.setFreight(new BigDecimal("45"));

			orders.add(ordervo1);
			orders.add(ordervo2);
			orders.add(ordervo2);
			groupVo1.setOrders(orders);

			// 买手2
			OrderGroupVo groupVo2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			groupVo2.setSellerCoupon(sellerCoupon2);
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			groupVo2.setSellerId(sellerId2);
			List<OrderVo> sellerId2orders1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");

			// 定义买手下订单列表
			List<OrderItemVo> sellerId2Items1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 1 + new Random().nextInt(5);
			sellerId2Item1.setProductNum(productNum2);
			sellerId2Item1.setProductName(productName);
			sellerId2Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Item1.setEarnestPrice(price2);
			sellerId2Item1.setProductPrice(price2);
			sellerId2Item1.setOriginalPrice(price2);
			sellerId2Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Item1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Items1.add(sellerId2Item1);
			ordervo2.setOrderItems(sellerId2Items1);
			ordervo2.setFreight(new BigDecimal("45"));
			sellerId2orders1.add(ordervo2);
			groupVo2.setOrders(sellerId2orders1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(groupVo1);
			orderGroupVos.add(groupVo2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_031() {
		Logger.start(true, "一次下单,多个商品,其中有商品适用于商家优惠活动,校验卖家优惠金额分摊");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo seller1 = new OrderGroupVo();
			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();
			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();
			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");
			Set<String> productList = new HashSet<String>();
			productList.add("aaaa");
			productList.add("bbbb");
			sellerPromotion1.setProductIds(productList);
			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);
			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.DiscountIfCountEnough);
			SellerPromotionVo sellerPromotion2 = new SellerPromotionVo();
			sellerPromotion2.setAmountCondition(new BigDecimal(100));
			sellerPromotion2.setId(123456789);
			sellerPromotion2.setName("自动化商家优惠活动");
			Set<String> productList2 = new HashSet<String>();
			productList2.add("cccc");
			sellerPromotion2.setProductIds(productList2);
			sellerPromotion2.setPromotionValue(new BigDecimal(12));
			sellerPromotion2.setQtyCondition(4);
			sellerPromotion2.setReducedAmount(new BigDecimal(17));
			sellerPromotion2.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotionList.add(sellerPromotion1);
			// sellerPromotionList.add(sellerPromotion2);

			seller1.setSellerPromotions(sellerPromotionList);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon
					.setApplianceType(SellerCouponApplianceTypeEnum.SPEC_RODUCT);
			// 指定aaaa 商品能用商家优惠券
			sellerCoupon.setApplianceTargets(Arrays.asList("aaaa"));
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			seller1.setSellerCoupon(sellerCoupon);
			seller1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> seller1orderList = new ArrayList<OrderVo>();
			// 订单1
			OrderVo seller1ordervo1 = new OrderVo();
			seller1ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo1.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo1.setPaidFull(true);
			seller1ordervo1.setAddress("上海市闸北区灵石路636号");
			seller1ordervo1.setLeaveWord("ymt autotest");
			seller1ordervo1.setPhone("13100000001");
			seller1ordervo1.setPostCode("200001");
			seller1ordervo1.setTelephone("021-51002100");
			seller1ordervo1.setReceiveName("李四aaaa");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo1ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 2;
			seller1ordervo1Item1.setProductNum(productNum1);
			seller1ordervo1Item1.setProductName(productName);
			seller1ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item1.setProductId("aaaa");
			BigDecimal price1 = new BigDecimal(210);
			seller1ordervo1Item1.setFirstCategoryId(1111);
			seller1ordervo1Item1.setSecondCategoryId(2222);
			seller1ordervo1Item1.setThirdCategoryId(3333);
			seller1ordervo1Item1.setSku("1234567");
			seller1ordervo1Item1.setEarnestPrice(price1
					.subtract(new BigDecimal(160)));
			seller1ordervo1Item1.setProductPrice(price1);
			seller1ordervo1Item1.setOriginalPrice(price1);
			seller1ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item1.setFirstCategoryId(111111111);
			seller1ordervo1Item1.setSecondCategoryId(22222222);
			seller1ordervo1Item1.setThirdCategoryId(3333333);
			// 订单下面的商品2
			OrderItemVo seller1ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 2;
			seller1ordervo1Item2.setProductNum(productNum1);
			seller1ordervo1Item2.setProductName(productName);
			seller1ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item2.setProductId("bbbb");
			price1 = new BigDecimal(230);
			seller1ordervo1Item2.setEarnestPrice(price1);
			seller1ordervo1Item2.setProductPrice(price1);
			seller1ordervo1Item2.setOriginalPrice(price1);
			seller1ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item2
					.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			seller1ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item2.setFirstCategoryId(111111111);
			seller1ordervo1Item2.setSecondCategoryId(22222222);
			seller1ordervo1Item2.setThirdCategoryId(3333333);
			// 订单下面的商品3
			OrderItemVo seller1ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 4;
			seller1ordervo1Item3.setProductNum(productNum1);
			seller1ordervo1Item3.setProductName(productName);
			seller1ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item3.setProductId("cccc");
			price1 = new BigDecimal(270);
			seller1ordervo1Item3.setEarnestPrice(price1);
			seller1ordervo1Item3.setProductPrice(price1);
			seller1ordervo1Item3.setOriginalPrice(price1);
			seller1ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			seller1ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item3.setFirstCategoryId(111111111);
			seller1ordervo1Item3.setSecondCategoryId(22222222);
			seller1ordervo1Item3.setThirdCategoryId(3333333);
			// 商品1
			seller1ordervo1ItemList1.add(seller1ordervo1Item1);
			// 商品2
			seller1ordervo1ItemList1.add(seller1ordervo1Item2);
			// 商品3
			seller1ordervo1ItemList1.add(seller1ordervo1Item3);
			// 订单1 的3个商品
			seller1ordervo1.setOrderItems(seller1ordervo1ItemList1);
			seller1ordervo1.setFreight(new BigDecimal("140"));

			// 订单2
			OrderVo seller1ordervo2 = new OrderVo();
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Spot);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo2.setAddress("上海市闸北区灵石路636号");
			seller1ordervo2.setLeaveWord("ymt autotest");
			seller1ordervo2.setPhone("13100000001");
			seller1ordervo2.setPostCode("200001");
			seller1ordervo2.setTelephone("021-51002100");
			seller1ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo2ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo2Item2 = new OrderItemVo();
			seller1ordervo2Item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 4;
			seller1ordervo2Item2.setProductNum(productNum);
			seller1ordervo2Item2.setProductName(productName);
			seller1ordervo2Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo2Item2.setProductId(productId);
			BigDecimal price = new BigDecimal(160);
			seller1ordervo2Item2.setEarnestPrice(price);
			seller1ordervo2Item2.setProductPrice(price);
			seller1ordervo2Item2.setOriginalPrice(price);
			seller1ordervo2Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo2Item2
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo2Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo2Item2.setFirstCategoryId(111111111);
			seller1ordervo2Item2.setSecondCategoryId(22222222);
			seller1ordervo2Item2.setThirdCategoryId(3333333);
			seller1ordervo2ItemList1.add(seller1ordervo2Item2);
			seller1ordervo2.setOrderItems(seller1ordervo2ItemList1);
			seller1ordervo2.setFreight(new BigDecimal("45"));

			seller1orderList.add(seller1ordervo1);
			seller1orderList.add(seller1ordervo2);
			// orders.add(ordervo2);
			seller1.setOrders(seller1orderList);

			// 买手2
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			OrderGroupVo seller2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId2, userId, sellerCouponValue2);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			seller2.setSellerCoupon(sellerCoupon2);

			seller2.setSellerId(sellerId2);

			List<OrderVo> sellerId2ordersList1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");
			// 定义买手下订单列表
			List<OrderItemVo> sellerId2ItemsList1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Order1Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Order1Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 4;
			sellerId2Order1Item1.setProductNum(productNum2);
			sellerId2Order1Item1.setProductName(productName);
			sellerId2Order1Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Order1Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Order1Item1.setEarnestPrice(price2);
			sellerId2Order1Item1.setProductPrice(price2);
			sellerId2Order1Item1.setOriginalPrice(price2);
			sellerId2Order1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Order1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Order1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Order1Item1.setFirstCategoryId(111111111);
			sellerId2Order1Item1.setSecondCategoryId(22222222);
			sellerId2Order1Item1.setThirdCategoryId(3333333);
			sellerId2ItemsList1.add(sellerId2Order1Item1);

			sellerId2order1.setOrderItems(sellerId2ItemsList1);
			sellerId2order1.setFreight(new BigDecimal("55"));

			sellerId2ordersList1.add(sellerId2order1);
			seller2.setOrders(sellerId2ordersList1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(seller1);
			orderGroupVos.add(seller2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_032() {
		Logger.start(true, "一次下单,多个商品,其中多个不同商品分别适用多个商家优惠活动,校验卖家优惠金额分摊");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo seller1 = new OrderGroupVo();

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();
			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();
			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");
			Set<String> productList = new HashSet<String>();
			productList.add("aaaa");
			productList.add("bbbb");
			sellerPromotion1.setProductIds(productList);
			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);
			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);
			SellerPromotionVo sellerPromotion2 = new SellerPromotionVo();
			sellerPromotion2.setAmountCondition(new BigDecimal(100));
			sellerPromotion2.setId(123456789);
			sellerPromotion2.setName("自动化商家优惠活动");
			Set<String> productList2 = new HashSet<String>();
			productList2.add("cccc");
			sellerPromotion2.setProductIds(productList2);
			sellerPromotion2.setPromotionValue(new BigDecimal(12));
			sellerPromotion2.setQtyCondition(4);
			sellerPromotion2.setReducedAmount(new BigDecimal(17));
			sellerPromotion2.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotionList.add(sellerPromotion1);
			sellerPromotionList.add(sellerPromotion2);

			seller1.setSellerPromotions(sellerPromotionList);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon
					.setApplianceType(SellerCouponApplianceTypeEnum.SPEC_RODUCT);
			// 指定aaaa 商品能用商家优惠券
			sellerCoupon.setApplianceTargets(Arrays.asList("aaaa"));
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			seller1.setSellerCoupon(sellerCoupon);
			seller1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> seller1orderList = new ArrayList<OrderVo>();
			// 订单1
			OrderVo seller1ordervo1 = new OrderVo();
			seller1ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo1.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo1.setPaidFull(true);
			seller1ordervo1.setAddress("上海市闸北区灵石路636号");
			seller1ordervo1.setLeaveWord("ymt autotest");
			seller1ordervo1.setPhone("13100000001");
			seller1ordervo1.setPostCode("200001");
			seller1ordervo1.setTelephone("021-51002100");
			seller1ordervo1.setReceiveName("李四aaaa");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo1ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 2;
			seller1ordervo1Item1.setProductNum(productNum1);
			seller1ordervo1Item1.setProductName(productName);
			seller1ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item1.setProductId("aaaa");
			BigDecimal price1 = new BigDecimal(210);
			seller1ordervo1Item1.setFirstCategoryId(1111);
			seller1ordervo1Item1.setSecondCategoryId(2222);
			seller1ordervo1Item1.setThirdCategoryId(3333);
			seller1ordervo1Item1.setSku("1234567");
			seller1ordervo1Item1.setEarnestPrice(price1
					.subtract(new BigDecimal(160)));
			seller1ordervo1Item1.setProductPrice(price1);
			seller1ordervo1Item1.setOriginalPrice(price1);
			seller1ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item1.setFirstCategoryId(111111111);
			seller1ordervo1Item1.setSecondCategoryId(22222222);
			seller1ordervo1Item1.setThirdCategoryId(3333333);
			// 订单下面的商品2
			OrderItemVo seller1ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 2;
			seller1ordervo1Item2.setProductNum(productNum1);
			seller1ordervo1Item2.setProductName(productName);
			seller1ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item2.setProductId("bbbb");
			price1 = new BigDecimal(230);
			seller1ordervo1Item2.setEarnestPrice(price1);
			seller1ordervo1Item2.setProductPrice(price1);
			seller1ordervo1Item2.setOriginalPrice(price1);
			seller1ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item2
					.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			seller1ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item2.setFirstCategoryId(111111111);
			seller1ordervo1Item2.setSecondCategoryId(22222222);
			seller1ordervo1Item2.setThirdCategoryId(3333333);
			// 订单下面的商品3
			OrderItemVo seller1ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 4;
			seller1ordervo1Item3.setProductNum(productNum1);
			seller1ordervo1Item3.setProductName(productName);
			seller1ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item3.setProductId("cccc");
			price1 = new BigDecimal(270);
			seller1ordervo1Item3.setEarnestPrice(price1);
			seller1ordervo1Item3.setProductPrice(price1);
			seller1ordervo1Item3.setOriginalPrice(price1);
			seller1ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			seller1ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item3.setFirstCategoryId(111111111);
			seller1ordervo1Item3.setSecondCategoryId(22222222);
			seller1ordervo1Item3.setThirdCategoryId(3333333);
			// 商品1
			seller1ordervo1ItemList1.add(seller1ordervo1Item1);
			// 商品2
			seller1ordervo1ItemList1.add(seller1ordervo1Item2);
			// 商品3
			seller1ordervo1ItemList1.add(seller1ordervo1Item3);
			// 订单1 的3个商品
			seller1ordervo1.setOrderItems(seller1ordervo1ItemList1);
			seller1ordervo1.setFreight(new BigDecimal("140"));

			// 订单2
			OrderVo seller1ordervo2 = new OrderVo();
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Spot);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAddress("上海市闸北区灵石路636号");
			seller1ordervo2.setLeaveWord("ymt autotest");
			seller1ordervo2.setPhone("13100000001");
			seller1ordervo2.setPostCode("200001");
			seller1ordervo2.setTelephone("021-51002100");
			seller1ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo2ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo2Item2 = new OrderItemVo();
			seller1ordervo2Item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 4;
			seller1ordervo2Item2.setProductNum(productNum);
			seller1ordervo2Item2.setProductName(productName);
			seller1ordervo2Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo2Item2.setProductId(productId);
			BigDecimal price = new BigDecimal(160);
			seller1ordervo2Item2.setEarnestPrice(price);
			seller1ordervo2Item2.setProductPrice(price);
			seller1ordervo2Item2.setOriginalPrice(price);
			seller1ordervo2Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo2Item2
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo2Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo2Item2.setFirstCategoryId(111111111);
			seller1ordervo2Item2.setSecondCategoryId(22222222);
			seller1ordervo2Item2.setThirdCategoryId(3333333);
			seller1ordervo2ItemList1.add(seller1ordervo2Item2);
			seller1ordervo2.setOrderItems(seller1ordervo2ItemList1);
			seller1ordervo2.setFreight(new BigDecimal("45"));

			seller1orderList.add(seller1ordervo1);
			seller1orderList.add(seller1ordervo2);
			// orders.add(ordervo2);
			seller1.setOrders(seller1orderList);

			// 买手2
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			OrderGroupVo seller2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			seller2.setSellerCoupon(sellerCoupon2);

			// int sellerId2 = 3383;
			seller2.setSellerId(sellerId2);

			List<OrderVo> sellerId2ordersList1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");
			// 定义买手下订单列表
			List<OrderItemVo> sellerId2ItemsList1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Order1Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Order1Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 4;
			sellerId2Order1Item1.setProductNum(productNum2);
			sellerId2Order1Item1.setProductName(productName);
			sellerId2Order1Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Order1Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Order1Item1.setEarnestPrice(price2);
			sellerId2Order1Item1.setProductPrice(price2);
			sellerId2Order1Item1.setOriginalPrice(price2);
			sellerId2Order1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Order1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Order1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Order1Item1.setFirstCategoryId(111111111);
			sellerId2Order1Item1.setSecondCategoryId(22222222);
			sellerId2Order1Item1.setThirdCategoryId(3333333);
			sellerId2ItemsList1.add(sellerId2Order1Item1);

			sellerId2order1.setOrderItems(sellerId2ItemsList1);
			sellerId2order1.setFreight(new BigDecimal("55"));

			sellerId2ordersList1.add(sellerId2order1);
			seller2.setOrders(sellerId2ordersList1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(seller1);
			orderGroupVos.add(seller2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_033() {
		Logger.start(false, "商家优惠活动,使用条件qtyCondition 为 0,AmountCondition为null");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo seller1 = new OrderGroupVo();

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();
			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();
			// sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");
			Set<String> productList = new HashSet<String>();
			productList.add("aaaa");
			productList.add("bbbb");
			sellerPromotion1.setProductIds(productList);
			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(0);
			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);
			SellerPromotionVo sellerPromotion2 = new SellerPromotionVo();
			sellerPromotion2.setAmountCondition(new BigDecimal(100));
			sellerPromotion2.setId(123456789);
			sellerPromotion2.setName("自动化商家优惠活动");
			Set<String> productList2 = new HashSet<String>();
			productList2.add("cccc");
			sellerPromotion2.setProductIds(productList2);
			sellerPromotion2.setPromotionValue(new BigDecimal(12));
			sellerPromotion2.setQtyCondition(4);
			sellerPromotion2.setReducedAmount(new BigDecimal(17));
			sellerPromotion2.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotionList.add(sellerPromotion1);
			sellerPromotionList.add(sellerPromotion2);

			seller1.setSellerPromotions(sellerPromotionList);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon
					.setApplianceType(SellerCouponApplianceTypeEnum.SPEC_RODUCT);
			// 指定aaaa 商品能用商家优惠券
			sellerCoupon.setApplianceTargets(Arrays.asList("aaaa"));
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			seller1.setSellerCoupon(sellerCoupon);
			seller1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> seller1orderList = new ArrayList<OrderVo>();
			// 订单1
			OrderVo seller1ordervo1 = new OrderVo();
			seller1ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo1.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo1.setPaidFull(true);
			seller1ordervo1.setAddress("上海市闸北区灵石路636号");
			seller1ordervo1.setLeaveWord("ymt autotest");
			seller1ordervo1.setPhone("13100000001");
			seller1ordervo1.setPostCode("200001");
			seller1ordervo1.setTelephone("021-51002100");
			seller1ordervo1.setReceiveName("李四aaaa");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo1ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 2;
			seller1ordervo1Item1.setProductNum(productNum1);
			seller1ordervo1Item1.setProductName(productName);
			seller1ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item1.setProductId("aaaa");
			BigDecimal price1 = new BigDecimal(210);
			seller1ordervo1Item1.setFirstCategoryId(1111);
			seller1ordervo1Item1.setSecondCategoryId(2222);
			seller1ordervo1Item1.setThirdCategoryId(3333);
			seller1ordervo1Item1.setSku("1234567");
			seller1ordervo1Item1.setEarnestPrice(price1
					.subtract(new BigDecimal(160)));
			seller1ordervo1Item1.setProductPrice(price1);
			seller1ordervo1Item1.setOriginalPrice(price1);
			seller1ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item1.setFirstCategoryId(111111111);
			seller1ordervo1Item1.setSecondCategoryId(22222222);
			seller1ordervo1Item1.setThirdCategoryId(3333333);
			// 订单下面的商品2
			OrderItemVo seller1ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 2;
			seller1ordervo1Item2.setProductNum(productNum1);
			seller1ordervo1Item2.setProductName(productName);
			seller1ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item2.setProductId("bbbb");
			price1 = new BigDecimal(230);
			seller1ordervo1Item2.setEarnestPrice(price1);
			seller1ordervo1Item2.setProductPrice(price1);
			seller1ordervo1Item2.setOriginalPrice(price1);
			seller1ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item2
					.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			seller1ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item2.setFirstCategoryId(111111111);
			seller1ordervo1Item2.setSecondCategoryId(22222222);
			seller1ordervo1Item2.setThirdCategoryId(3333333);
			// 订单下面的商品3
			OrderItemVo seller1ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 4;
			seller1ordervo1Item3.setProductNum(productNum1);
			seller1ordervo1Item3.setProductName(productName);
			seller1ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item3.setProductId("cccc");
			price1 = new BigDecimal(270);
			seller1ordervo1Item3.setEarnestPrice(price1);
			seller1ordervo1Item3.setProductPrice(price1);
			seller1ordervo1Item3.setOriginalPrice(price1);
			seller1ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			seller1ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item3.setFirstCategoryId(111111111);
			seller1ordervo1Item3.setSecondCategoryId(22222222);
			seller1ordervo1Item3.setThirdCategoryId(3333333);
			// 商品1
			seller1ordervo1ItemList1.add(seller1ordervo1Item1);
			// 商品2
			seller1ordervo1ItemList1.add(seller1ordervo1Item2);
			// 商品3
			seller1ordervo1ItemList1.add(seller1ordervo1Item3);
			// 订单1 的3个商品
			seller1ordervo1.setOrderItems(seller1ordervo1ItemList1);
			seller1ordervo1.setFreight(new BigDecimal("140"));

			// 订单2
			OrderVo seller1ordervo2 = new OrderVo();
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Spot);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAddress("上海市闸北区灵石路636号");
			seller1ordervo2.setLeaveWord("ymt autotest");
			seller1ordervo2.setPhone("13100000001");
			seller1ordervo2.setPostCode("200001");
			seller1ordervo2.setTelephone("021-51002100");
			seller1ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo2ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo2Item2 = new OrderItemVo();
			seller1ordervo2Item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 4;
			seller1ordervo2Item2.setProductNum(productNum);
			seller1ordervo2Item2.setProductName(productName);
			seller1ordervo2Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo2Item2.setProductId(productId);
			BigDecimal price = new BigDecimal(160);
			seller1ordervo2Item2.setEarnestPrice(price);
			seller1ordervo2Item2.setProductPrice(price);
			seller1ordervo2Item2.setOriginalPrice(price);
			seller1ordervo2Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo2Item2
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo2Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo2Item2.setFirstCategoryId(111111111);
			seller1ordervo2Item2.setSecondCategoryId(22222222);
			seller1ordervo2Item2.setThirdCategoryId(3333333);
			seller1ordervo2ItemList1.add(seller1ordervo2Item2);
			seller1ordervo2.setOrderItems(seller1ordervo2ItemList1);
			seller1ordervo2.setFreight(new BigDecimal("45"));

			seller1orderList.add(seller1ordervo1);
			seller1orderList.add(seller1ordervo2);
			// orders.add(ordervo2);
			seller1.setOrders(seller1orderList);

			// 买手2
			OrderGroupVo seller2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			seller2.setSellerCoupon(sellerCoupon2);
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			seller2.setSellerId(sellerId2);

			List<OrderVo> sellerId2ordersList1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");
			// 定义买手下订单列表
			List<OrderItemVo> sellerId2ItemsList1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Order1Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Order1Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 4;
			sellerId2Order1Item1.setProductNum(productNum2);
			sellerId2Order1Item1.setProductName(productName);
			sellerId2Order1Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Order1Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Order1Item1.setEarnestPrice(price2);
			sellerId2Order1Item1.setProductPrice(price2);
			sellerId2Order1Item1.setOriginalPrice(price2);
			sellerId2Order1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Order1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Order1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Order1Item1.setFirstCategoryId(111111111);
			sellerId2Order1Item1.setSecondCategoryId(22222222);
			sellerId2Order1Item1.setThirdCategoryId(3333333);
			sellerId2ItemsList1.add(sellerId2Order1Item1);

			sellerId2order1.setOrderItems(sellerId2ItemsList1);
			sellerId2order1.setFreight(new BigDecimal("55"));

			sellerId2ordersList1.add(sellerId2order1);
			seller2.setOrders(sellerId2ordersList1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(seller1);
			orderGroupVos.add(seller2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals("卖家优惠活动条件未提供:"
					+ placeorderBean.getOrderGroups().get(0)
							.getSellerPromotions().get(0).getId(),
					placeorderCall.getString("msg"), "验证msg");
			Logger.verifyEquals("ILLEGAL_ARGUMENT", placeorderCall.getData()
					.getString("errorCode"), "验证errorCode");
			Logger.verifyEquals("卖家优惠活动条件未提供:"
					+ placeorderBean.getOrderGroups().get(0)
							.getSellerPromotions().get(0).getId(),
					placeorderCall.getData().getString("errorMessage"),
					"验证errorMessage");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "验证success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_034() {
		Logger.start(false, "商家优惠活动,使用条件qtyCondition 为 0,AmountCondition为0");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			// 平台优惠券
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setOrderSource(OrderSourceEnum.APP);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			// 买手1
			OrderGroupVo seller1 = new OrderGroupVo();

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();
			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();
			sellerPromotion1.setAmountCondition(new BigDecimal(0));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");
			Set<String> productList = new HashSet<String>();
			productList.add("aaaa");
			productList.add("bbbb");
			sellerPromotion1.setProductIds(productList);
			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(0);
			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);
			SellerPromotionVo sellerPromotion2 = new SellerPromotionVo();
			sellerPromotion2.setAmountCondition(new BigDecimal(100));
			sellerPromotion2.setId(123456789);
			sellerPromotion2.setName("自动化商家优惠活动");
			Set<String> productList2 = new HashSet<String>();
			productList2.add("cccc");
			sellerPromotion2.setProductIds(productList2);
			sellerPromotion2.setPromotionValue(new BigDecimal(12));
			sellerPromotion2.setQtyCondition(4);
			sellerPromotion2.setReducedAmount(new BigDecimal(17));
			sellerPromotion2.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotionList.add(sellerPromotion1);
			sellerPromotionList.add(sellerPromotion2);

			seller1.setSellerPromotions(sellerPromotionList);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon
					.setApplianceType(SellerCouponApplianceTypeEnum.SPEC_RODUCT);
			// 指定aaaa 商品能用商家优惠券
			sellerCoupon.setApplianceTargets(Arrays.asList("aaaa"));
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			seller1.setSellerCoupon(sellerCoupon);
			seller1.setSellerId(sellerId);
			// 定义买手下订单列表
			List<OrderVo> seller1orderList = new ArrayList<OrderVo>();
			// 订单1
			OrderVo seller1ordervo1 = new OrderVo();
			seller1ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo1.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo1.setPaidFull(true);
			seller1ordervo1.setAddress("上海市闸北区灵石路636号");
			seller1ordervo1.setLeaveWord("ymt autotest");
			seller1ordervo1.setPhone("13100000001");
			seller1ordervo1.setPostCode("200001");
			seller1ordervo1.setTelephone("021-51002100");
			seller1ordervo1.setReceiveName("李四aaaa");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo1ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo1Item1 = new OrderItemVo();
			String catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item1.setCatalogId(catalogId);
			// 商品数量
			int productNum1 = 2;
			seller1ordervo1Item1.setProductNum(productNum1);
			seller1ordervo1Item1.setProductName(productName);
			seller1ordervo1Item1.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item1.setProductId("aaaa");
			BigDecimal price1 = new BigDecimal(210);
			seller1ordervo1Item1.setFirstCategoryId(1111);
			seller1ordervo1Item1.setSecondCategoryId(2222);
			seller1ordervo1Item1.setThirdCategoryId(3333);
			seller1ordervo1Item1.setSku("1234567");
			seller1ordervo1Item1.setEarnestPrice(price1
					.subtract(new BigDecimal(160)));
			seller1ordervo1Item1.setProductPrice(price1);
			seller1ordervo1Item1.setOriginalPrice(price1);
			seller1ordervo1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item1.setFirstCategoryId(111111111);
			seller1ordervo1Item1.setSecondCategoryId(22222222);
			seller1ordervo1Item1.setThirdCategoryId(3333333);
			// 订单下面的商品2
			OrderItemVo seller1ordervo1Item2 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item2.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 2;
			seller1ordervo1Item2.setProductNum(productNum1);
			seller1ordervo1Item2.setProductName(productName);
			seller1ordervo1Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item2.setProductId("bbbb");
			price1 = new BigDecimal(230);
			seller1ordervo1Item2.setEarnestPrice(price1);
			seller1ordervo1Item2.setProductPrice(price1);
			seller1ordervo1Item2.setOriginalPrice(price1);
			seller1ordervo1Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item2
					.setLogisticsType(LogisticsTypeEnum.PackageDelivery);
			seller1ordervo1Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item2.setFirstCategoryId(111111111);
			seller1ordervo1Item2.setSecondCategoryId(22222222);
			seller1ordervo1Item2.setThirdCategoryId(3333333);
			// 订单下面的商品3
			OrderItemVo seller1ordervo1Item3 = new OrderItemVo();
			catalogId = TestDataManager.getRandomUUID().toString();
			seller1ordervo1Item3.setCatalogId(catalogId);
			// 商品数量
			productNum1 = 4;
			seller1ordervo1Item3.setProductNum(productNum1);
			seller1ordervo1Item3.setProductName(productName);
			seller1ordervo1Item3.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo1Item3.setProductId("cccc");
			price1 = new BigDecimal(270);
			seller1ordervo1Item3.setEarnestPrice(price1);
			seller1ordervo1Item3.setProductPrice(price1);
			seller1ordervo1Item3.setOriginalPrice(price1);
			seller1ordervo1Item3.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo1Item3.setLogisticsType(LogisticsTypeEnum.US);
			seller1ordervo1Item3
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo1Item3.setFirstCategoryId(111111111);
			seller1ordervo1Item3.setSecondCategoryId(22222222);
			seller1ordervo1Item3.setThirdCategoryId(3333333);
			// 商品1
			seller1ordervo1ItemList1.add(seller1ordervo1Item1);
			// 商品2
			seller1ordervo1ItemList1.add(seller1ordervo1Item2);
			// 商品3
			seller1ordervo1ItemList1.add(seller1ordervo1Item3);
			// 订单1 的3个商品
			seller1ordervo1.setOrderItems(seller1ordervo1ItemList1);
			seller1ordervo1.setFreight(new BigDecimal("140"));

			// 订单2
			OrderVo seller1ordervo2 = new OrderVo();
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Spot);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAutoCancelOrderHours(new BigDecimal(1));
			seller1ordervo2.setOrderType(OrderTypeEnum.Shangou);
			seller1ordervo2.setPaidFull(true);
			seller1ordervo2.setAddress("上海市闸北区灵石路636号");
			seller1ordervo2.setLeaveWord("ymt autotest");
			seller1ordervo2.setPhone("13100000001");
			seller1ordervo2.setPostCode("200001");
			seller1ordervo2.setTelephone("021-51002100");
			seller1ordervo2.setReceiveName("李四");
			// 定义买手下订单下商品
			List<OrderItemVo> seller1ordervo2ItemList1 = new ArrayList<OrderItemVo>();
			// 订单下面的商品
			OrderItemVo seller1ordervo2Item2 = new OrderItemVo();
			seller1ordervo2Item2.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum = 4;
			seller1ordervo2Item2.setProductNum(productNum);
			seller1ordervo2Item2.setProductName(productName);
			seller1ordervo2Item2.setPriceType(PriceTypeEnum.VipPrice);
			seller1ordervo2Item2.setProductId(productId);
			BigDecimal price = new BigDecimal(160);
			seller1ordervo2Item2.setEarnestPrice(price);
			seller1ordervo2Item2.setProductPrice(price);
			seller1ordervo2Item2.setOriginalPrice(price);
			seller1ordervo2Item2.setSalesType(SalesTypeEnum.AlreadyInStock);
			seller1ordervo2Item2
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			seller1ordervo2Item2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			seller1ordervo2Item2.setFirstCategoryId(111111111);
			seller1ordervo2Item2.setSecondCategoryId(22222222);
			seller1ordervo2Item2.setThirdCategoryId(3333333);
			seller1ordervo2ItemList1.add(seller1ordervo2Item2);
			seller1ordervo2.setOrderItems(seller1ordervo2ItemList1);
			seller1ordervo2.setFreight(new BigDecimal("45"));

			seller1orderList.add(seller1ordervo1);
			seller1orderList.add(seller1ordervo2);
			// orders.add(ordervo2);
			seller1.setOrders(seller1orderList);

			// 买手2
			OrderGroupVo seller2 = new OrderGroupVo();
			// 商家优惠券
			BigDecimal sellerCouponValue2 = new BigDecimal(15);
			String sellerCouponCode2 = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon2 = new SellerCouponVo();
			sellerCoupon2.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon2.setCouponCode(sellerCouponCode2);
			sellerCoupon2.setCouponValue(sellerCouponValue2);
			seller2.setSellerCoupon(sellerCoupon2);
			// 卖家2
			int sellerId2 = Integer.valueOf(EnvSetup.getData("BuyerId"));
			seller2.setSellerId(sellerId2);

			List<OrderVo> sellerId2ordersList1 = new ArrayList<OrderVo>();
			OrderVo sellerId2order1 = new OrderVo();
			sellerId2order1.setAutoCancelOrderHours(new BigDecimal(1));
			sellerId2order1.setOrderType(OrderTypeEnum.Spot);
			sellerId2order1.setPaidFull(true);
			sellerId2order1.setAddress("上海市闸北区灵石路636号");
			sellerId2order1.setLeaveWord("ymt autotest");
			sellerId2order1.setPhone("13100000001");
			sellerId2order1.setPostCode("200001");
			sellerId2order1.setTelephone("021-51002100");
			sellerId2order1.setReceiveName("李四");
			// 定义买手下订单列表
			List<OrderItemVo> sellerId2ItemsList1 = new ArrayList<OrderItemVo>();
			// 订单1
			OrderItemVo sellerId2Order1Item1 = new OrderItemVo();

			String catalogId2 = TestDataManager.getRandomUUID().toString();
			sellerId2Order1Item1.setCatalogId(TestDataManager.getRandomUUID()
					.toString());
			// 商品数量
			int productNum2 = 4;
			sellerId2Order1Item1.setProductNum(productNum2);
			sellerId2Order1Item1.setProductName(productName);
			sellerId2Order1Item1.setPriceType(PriceTypeEnum.VipPrice);
			sellerId2Order1Item1.setProductId(productId);
			BigDecimal price2 = new BigDecimal(270);
			sellerId2Order1Item1.setEarnestPrice(price2);
			sellerId2Order1Item1.setProductPrice(price2);
			sellerId2Order1Item1.setOriginalPrice(price2);
			sellerId2Order1Item1.setSalesType(SalesTypeEnum.AlreadyInStock);
			sellerId2Order1Item1
					.setLogisticsType(LogisticsTypeEnum.SailProtect);
			sellerId2Order1Item1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			sellerId2Order1Item1.setFirstCategoryId(111111111);
			sellerId2Order1Item1.setSecondCategoryId(22222222);
			sellerId2Order1Item1.setThirdCategoryId(3333333);
			sellerId2ItemsList1.add(sellerId2Order1Item1);

			sellerId2order1.setOrderItems(sellerId2ItemsList1);
			sellerId2order1.setFreight(new BigDecimal("55"));

			sellerId2ordersList1.add(sellerId2order1);
			seller2.setOrders(sellerId2ordersList1);

			// 定义买手列表
			List<OrderGroupVo> orderGroupVos = new ArrayList<OrderGroupVo>();
			orderGroupVos.add(seller1);
			orderGroupVos.add(seller2);
			placeorderBean.setOrderGroups(orderGroupVos);
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");
			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证bcode");
			Logger.verifyEquals("ILLEGAL_ARGUMENT", placeorderCall.getData()
					.getString("errorCode"), "验证errorCode");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "验证success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_035() {
		Logger.start(true, "创建一个M活动贝海物流订单,贝海身份验证");
		try {
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);

			List<YmtCouponPrivateUserBound> listCoupon = new YmtCouponPrivateUserBoundWapper()
					.selectBysCouponCode(couponCode);
			int beforeCount = listCoupon.get(0).getiCouponUsedCount();
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			placeorderBean.setSourceIp("127.0.0.1");
			placeorderBean.setAppId("ios");
			placeorderBean.setDeviceId("7777777777888888888888999");
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.PC);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Spot);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");

			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setCatalogId(TestDataManager.getRandomUUID().toString());
			orderitem1.setProductNum(1);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setProductId(productId);
			price = new BigDecimal(210);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.XloboBondedDelivery);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1.setFirstCategoryId(111111111);
			orderitem1.setSecondCategoryId(22222222);
			orderitem1.setThirdCategoryId(3333333);
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			ActivityVo activity = new ActivityVo();
			activity.setActivityId(46870);
			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);
			orderitem1.setActivity(activity);
			items.add(orderitem1);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);

			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();
			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
			int orderId = placeorderCall.getOrderIds().getInt(0);
			DefaultWapper database = new DefaultWapper();
			Logger.verifyEquals(true, database.selectOrderExtByOderId(orderId)
					.get(0).get("bIsNeedUploadIdCard"), "贝海直邮商品需要上传身份证信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_036() {
		Logger.start(true, "创建预售商品订单");
		try {
			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			// 预售订单
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setPreSale(true);

			OrderItemVo orderitem1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			// 预售商品
			orderitem1.setPreSale(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_037() {
		Logger.start(true, "创建PSP商品订单");
		try {
			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo orderitem1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			// 预售商品
			orderitem1.setPreSale(true);
			orderitem1.setPspProduct(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_038() {
		Logger.start(true, "砍价团订单下单成功");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			// 创建砍价团订单
			BizVo bizVo = new BizVo();
			// 砍价团id
			String bizId = TestDataManager.getRandomNum(5);
			// 1:砍价团
			int bizType = 1;
			// 砍价团(1 开团, 2 参团)
			Integer bizSubType = 1;

			bizVo.setBizId(bizId);
			bizVo.setBizType(bizType);
			bizVo.setBizSubType(bizSubType);

			placeorderBean.setBizSource(bizVo);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");
			// 数据库验证
			verifyDb();
			verifyBargainGroup();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_039() {
		Logger.start(true, "商家优惠，满2减1");
		try {

			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));

			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderVo orderVo = PlaceOrderService.getDefaultOrderVo(userId);

			//修改默认创建的商品价格，规格id
			orderVo.getOrderItems().get(0)
					.setOriginalPrice(new BigDecimal(400));
			orderVo.getOrderItems().get(0).setEarnestPrice(new BigDecimal(400));
			orderVo.getOrderItems().get(0).setProductPrice(new BigDecimal(400));
			orderVo.getOrderItems().get(0)
					.setCatalogId("bfbfefb3-6232-4fe5-ba34-0c247e5aa657");
			orderVo.getOrderItems().get(0)
					.setProductId("540a126a-c6ad-4d6d-98af-671cc03633c6");
			orderVo.getOrderItems().get(0).setProductNum(3);

			OrderItemVo orderItemVo = PlaceOrderService.getDefaultOrderItemVo();

			orderItemVo.setOriginalPrice(new BigDecimal(200));
			orderItemVo.setEarnestPrice(new BigDecimal(200));
			orderItemVo.setProductPrice(new BigDecimal(200));
			orderItemVo.setCatalogId("59dff53a-f26e-4a9f-aa43-20a58c432b48");
			orderItemVo.setProductId("540a126a-c6ad-4d6d-98af-671cc03633c6");
			orderItemVo.setProductNum(3);

			orderVo.getOrderItems().add(orderItemVo);

			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			//修改默认创建的商品价格，规格id
			orderVo2.getOrderItems().get(0)
					.setOriginalPrice(new BigDecimal(300));
			orderVo2.getOrderItems().get(0)
					.setEarnestPrice(new BigDecimal(300));
			orderVo2.getOrderItems().get(0)
					.setProductPrice(new BigDecimal(300));
			orderVo2.getOrderItems().get(0)
					.setCatalogId("42db30b9-af69-48c4-9447-a317266cd68c");
			orderVo2.getOrderItems().get(0)
					.setProductId("540a126a-c6ad-4d6d-98af-671cc03633c6");
			orderVo2.getOrderItems().get(0).setProductNum(3);

			List<OrderVo> orderVoList = new ArrayList<OrderVo>();

			orderVoList.add(orderVo);
			orderVoList.add(orderVo2);

			placeorderBean.getOrderGroups().get(0).setOrders(orderVoList);

			List<SellerPromotionApportionVo> sellerPromotionApportions = new ArrayList<SellerPromotionApportionVo>();

			SellerPromotionApportionVo sellerPromotionApportionVo1 = new SellerPromotionApportionVo();

			sellerPromotionApportionVo1.setApportions(Arrays.asList(
					new CatalogApportionVo(
							"bfbfefb3-6232-4fe5-ba34-0c247e5aa657", 1),
					new CatalogApportionVo(
							"bfbfefb3-6232-4fe5-ba34-0c247e5aa657", 1)));
			sellerPromotionApportionVo1.setId(5838L);
			sellerPromotionApportionVo1.setName("半价");
			sellerPromotionApportionVo1.setPromotionValue(new BigDecimal(0.5));
			sellerPromotionApportionVo1.setQtyCondition(2);
			sellerPromotionApportionVo1.setReducedAmount(new BigDecimal(200));
			sellerPromotionApportionVo1
					.setType(PromotionTypeEnum.HalfIfCountEnough);

			SellerPromotionApportionVo sellerPromotionApportionVo2 = new SellerPromotionApportionVo();

			sellerPromotionApportionVo2.setApportions(Arrays.asList(
					new CatalogApportionVo(
							"bfbfefb3-6232-4fe5-ba34-0c247e5aa657", 1),
					new CatalogApportionVo(
							"42db30b9-af69-48c4-9447-a317266cd68c", 1)));
			sellerPromotionApportionVo2.setId(5838L);
			sellerPromotionApportionVo2.setName("半价");
			sellerPromotionApportionVo2.setPromotionValue(new BigDecimal(0.5));
			sellerPromotionApportionVo2.setQtyCondition(2);
			sellerPromotionApportionVo2.setReducedAmount(new BigDecimal(150));
			sellerPromotionApportionVo2
					.setType(PromotionTypeEnum.HalfIfCountEnough);

			SellerPromotionApportionVo sellerPromotionApportionVo3 = new SellerPromotionApportionVo();

			sellerPromotionApportionVo3.setApportions(Arrays.asList(
					new CatalogApportionVo(
							"42db30b9-af69-48c4-9447-a317266cd68c", 1),
					new CatalogApportionVo(
							"42db30b9-af69-48c4-9447-a317266cd68c", 1)));
			sellerPromotionApportionVo3.setId(5838L);
			sellerPromotionApportionVo3.setName("半价");
			sellerPromotionApportionVo3.setPromotionValue(new BigDecimal(0.5));
			sellerPromotionApportionVo3.setQtyCondition(2);
			sellerPromotionApportionVo3.setReducedAmount(new BigDecimal(150));
			sellerPromotionApportionVo3
					.setType(PromotionTypeEnum.HalfIfCountEnough);

			SellerPromotionApportionVo sellerPromotionApportionVo4 = new SellerPromotionApportionVo();

			sellerPromotionApportionVo4.setApportions(Arrays.asList(
					new CatalogApportionVo(
							"59dff53a-f26e-4a9f-aa43-20a58c432b48", 1),
					new CatalogApportionVo(
							"59dff53a-f26e-4a9f-aa43-20a58c432b48", 1)));
			sellerPromotionApportionVo4.setId(5838L);
			sellerPromotionApportionVo4.setName("半价");
			sellerPromotionApportionVo4.setPromotionValue(new BigDecimal(0.5));
			sellerPromotionApportionVo4.setQtyCondition(2);
			sellerPromotionApportionVo4.setReducedAmount(new BigDecimal(100));
			sellerPromotionApportionVo4
					.setType(PromotionTypeEnum.HalfIfCountEnough);

			sellerPromotionApportions.add(sellerPromotionApportionVo1);

			sellerPromotionApportions.add(sellerPromotionApportionVo2);

			sellerPromotionApportions.add(sellerPromotionApportionVo3);

			sellerPromotionApportions.add(sellerPromotionApportionVo4);

			placeorderBean.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionApportions);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证

			verifyHalfIfCountEnough();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_040() {
		Logger.start(true, "商家优惠，既有 满2减1活动商品,又有满立减活动商品 ");
		try {

			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));

			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderVo orderVo = PlaceOrderService.getDefaultOrderVo(userId);

			//修改默认创建的商品价格，规格id
			orderVo.getOrderItems().get(0)
					.setOriginalPrice(new BigDecimal(400));
			orderVo.getOrderItems().get(0).setEarnestPrice(new BigDecimal(400));
			orderVo.getOrderItems().get(0).setProductPrice(new BigDecimal(400));
			orderVo.getOrderItems().get(0)
					.setCatalogId("bfbfefb3-6232-4fe5-ba34-0c247e5aa657");
			orderVo.getOrderItems().get(0)
					.setProductId("540a126a-c6ad-4d6d-98af-671cc03633c6");
			orderVo.getOrderItems().get(0).setProductNum(5);

			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			//修改默认创建的商品价格，规格id
			orderVo2.getOrderItems().get(0)
					.setOriginalPrice(new BigDecimal(400));
			orderVo2.getOrderItems().get(0)
					.setEarnestPrice(new BigDecimal(400));
			orderVo2.getOrderItems().get(0)
					.setProductPrice(new BigDecimal(400));
			orderVo2.getOrderItems().get(0)
					.setCatalogId("bfbfefb3-6232-4fe5-ba34-0c247e5aa657");
			orderVo2.getOrderItems().get(0)
					.setProductId("540a126a-c6ad-4d6d-98af-671cc03633c6");
			orderVo2.getOrderItems().get(0).setProductNum(1);

			OrderVo orderVo3 = PlaceOrderService.getDefaultOrderVo(userId);

			//修改默认创建的商品价格，规格id
			orderVo3.getOrderItems().get(0)
					.setOriginalPrice(new BigDecimal(200));
			orderVo3.getOrderItems().get(0)
					.setEarnestPrice(new BigDecimal(200));
			orderVo3.getOrderItems().get(0)
					.setProductPrice(new BigDecimal(200));
			orderVo3.getOrderItems().get(0)
					.setCatalogId("59dff53a-f26e-4a9f-aa43-20a58c432b48");
			orderVo3.getOrderItems().get(0)
					.setProductId("540a126a-c6ad-4d6d-98af-671cc03633c6");
			orderVo3.getOrderItems().get(0).setProductNum(9);

			OrderVo orderVo4 = PlaceOrderService.getDefaultOrderVo(userId);

			//修改默认创建的商品价格，规格id
			orderVo4.getOrderItems().get(0)
					.setOriginalPrice(new BigDecimal(300));
			orderVo4.getOrderItems().get(0)
					.setEarnestPrice(new BigDecimal(300));
			orderVo4.getOrderItems().get(0)
					.setProductPrice(new BigDecimal(300));
			orderVo4.getOrderItems().get(0)
					.setCatalogId("dcb09bf4-ecb2-454a-aeb5-bfd4516bf9f3");
			orderVo4.getOrderItems().get(0)
					.setProductId("d9f9002f-863f-478b-a453-754eaef88a23");
			orderVo4.getOrderItems().get(0).setProductNum(3);

			List<OrderVo> orderVoList = new ArrayList<OrderVo>();

			orderVoList.add(orderVo);
			orderVoList.add(orderVo2);
			orderVoList.add(orderVo3);
			orderVoList.add(orderVo4);

			placeorderBean.getOrderGroups().get(0).setOrders(orderVoList);

			List<SellerPromotionApportionVo> sellerPromotionApportions = new ArrayList<SellerPromotionApportionVo>();

			SellerPromotionApportionVo sellerPromotionApportionVo1 = new SellerPromotionApportionVo();

			sellerPromotionApportionVo1.setApportions(Arrays.asList(
					new CatalogApportionVo(
							"bfbfefb3-6232-4fe5-ba34-0c247e5aa657", 1),
					new CatalogApportionVo(
							"bfbfefb3-6232-4fe5-ba34-0c247e5aa657", 1)));
			sellerPromotionApportionVo1.setId(5838L);
			sellerPromotionApportionVo1.setName("半价");
			sellerPromotionApportionVo1.setPromotionValue(new BigDecimal(0.5));
			sellerPromotionApportionVo1.setQtyCondition(2);
			sellerPromotionApportionVo1.setReducedAmount(new BigDecimal(200));
			sellerPromotionApportionVo1
					.setType(PromotionTypeEnum.HalfIfCountEnough);

			SellerPromotionApportionVo sellerPromotionApportionVo2 = new SellerPromotionApportionVo();

			sellerPromotionApportionVo2.setApportions(Arrays.asList(
					new CatalogApportionVo(
							"59dff53a-f26e-4a9f-aa43-20a58c432b48", 1),
					new CatalogApportionVo(
							"59dff53a-f26e-4a9f-aa43-20a58c432b48", 1)));
			sellerPromotionApportionVo2.setId(5838L);
			sellerPromotionApportionVo2.setName("半价");
			sellerPromotionApportionVo2.setPromotionValue(new BigDecimal(0.5));
			sellerPromotionApportionVo2.setQtyCondition(2);
			sellerPromotionApportionVo2.setReducedAmount(new BigDecimal(100));
			sellerPromotionApportionVo2
					.setType(PromotionTypeEnum.HalfIfCountEnough);

			sellerPromotionApportions.add(sellerPromotionApportionVo1);

			sellerPromotionApportions.add(sellerPromotionApportionVo1);

			sellerPromotionApportions.add(sellerPromotionApportionVo1);

			sellerPromotionApportions.add(sellerPromotionApportionVo2);

			sellerPromotionApportions.add(sellerPromotionApportionVo2);

			sellerPromotionApportions.add(sellerPromotionApportionVo2);

			sellerPromotionApportions.add(sellerPromotionApportionVo2);

			placeorderBean.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionApportions);

			// 商家优惠活动

			SellerPromotionVo sellerPromotion = new SellerPromotionVo();
			sellerPromotion.setAmountCondition(new BigDecimal(100));
			sellerPromotion.setId(5844);
			sellerPromotion.setName("满减促销");

			Set<String> productList = new HashSet<String>();
			productList.add("d9f9002f-863f-478b-a453-754eaef88a23");
			sellerPromotion.setProductIds(productList);
			sellerPromotion.setPromotionValue(new BigDecimal(3));
			sellerPromotion.setQtyCondition(2);
			sellerPromotion.setReducedAmount(new BigDecimal(3));
			sellerPromotion.setType(PromotionTypeEnum.ReduceIfCountEnough);

			placeorderBean.getOrderGroups().get(0)
					.setSellerPromotions(Arrays.asList(sellerPromotion));

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyHalfIfCountEnough();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_041() {
		Logger.start(true, "创建一个大面额优惠卷,实付金额为1元的订单,校验优惠金额分摊");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			placeorderBean
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.addAll(Arrays.asList(
							PlaceOrderService.getDefaultOrderItemVo(),
							PlaceOrderService.getDefaultOrderItemVo()));

			placeorderBean
					.getOrderGroups()
					.get(0)
					.getOrders()
					.addAll(Arrays.asList(
							PlaceOrderService.getDefaultOrderVo(null),
							PlaceOrderService.getDefaultOrderVo(null)));

			BigDecimal productTotalPay = BigDecimal.ZERO;

			BigDecimal sellerCoupon = placeorderBean.getOrderGroups().get(0)
					.getSellerCoupon().getCouponValue();

			BigDecimal freight = BigDecimal.ZERO;
			for (OrderVo orderVo : placeorderBean.getOrderGroups().get(0)
					.getOrders()) {

				orderVo.setFreight(BigDecimal.ZERO);

				orderVo.getOrderItems().forEach(item -> item.getEarnestPrice());

				productTotalPay = orderVo
						.getOrderItems()
						.stream()
						.map(item -> item.getEarnestPrice().multiply(
								new BigDecimal(item.getProductNum())))
						.reduce(BigDecimal.ZERO, BigDecimal::add)
						.add(productTotalPay);;

				//freight = freight.add(orderVo.getFreight());
			}

			BigDecimal ymtCoupon = productTotalPay.add(freight)
					.subtract(sellerCoupon).subtract(BigDecimal.ONE);

			placeorderBean.getYmatouCoupon().setCouponValue(ymtCoupon);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();
			// Thread.sleep(3000);
			verifyBaseInfo();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_042() {
		Logger.start(true, "创建一个大面额优惠卷,实付金额为0.1元的订单,校验优惠金额分摊");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			placeorderBean
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.addAll(Arrays.asList(
							PlaceOrderService.getDefaultOrderItemVo(),
							PlaceOrderService.getDefaultOrderItemVo()));

			placeorderBean
					.getOrderGroups()
					.get(0)
					.getOrders()
					.addAll(Arrays.asList(
							PlaceOrderService.getDefaultOrderVo(null),
							PlaceOrderService.getDefaultOrderVo(null)));

			BigDecimal productTotalPay = BigDecimal.ZERO;

			BigDecimal sellerCoupon = placeorderBean.getOrderGroups().get(0)
					.getSellerCoupon().getCouponValue();

			BigDecimal freight = BigDecimal.ZERO;
			for (OrderVo orderVo : placeorderBean.getOrderGroups().get(0)
					.getOrders()) {

				orderVo.setFreight(BigDecimal.ZERO);

				orderVo.getOrderItems().forEach(item -> item.getEarnestPrice());

				productTotalPay = orderVo
						.getOrderItems()
						.stream()
						.map(item -> item.getEarnestPrice().multiply(
								new BigDecimal(item.getProductNum())))
						.reduce(BigDecimal.ZERO, BigDecimal::add)
						.add(productTotalPay);;

				//freight = freight.add(orderVo.getFreight());
			}

			BigDecimal ymtCoupon = productTotalPay
					.add(freight)
					.subtract(sellerCoupon)
					.subtract(
							new BigDecimal(0.1, MathContext.DECIMAL32)
									.setScale(1));

			placeorderBean.getYmatouCoupon().setCouponValue(ymtCoupon);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();
			// Thread.sleep(3000);
			verifyBaseInfo();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_043() {
		Logger.start(true, "创建一个大面额优惠卷,实付金额为0.01元的订单,校验优惠金额分摊");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			placeorderBean
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.addAll(Arrays.asList(
							PlaceOrderService.getDefaultOrderItemVo(),
							PlaceOrderService.getDefaultOrderItemVo()));

			placeorderBean
					.getOrderGroups()
					.get(0)
					.getOrders()
					.addAll(Arrays.asList(
							PlaceOrderService.getDefaultOrderVo(null),
							PlaceOrderService.getDefaultOrderVo(null)));

			BigDecimal productTotalPay = BigDecimal.ZERO;

			BigDecimal sellerCoupon = placeorderBean.getOrderGroups().get(0)
					.getSellerCoupon().getCouponValue();

			BigDecimal freight = BigDecimal.ZERO;
			for (OrderVo orderVo : placeorderBean.getOrderGroups().get(0)
					.getOrders()) {

				orderVo.setFreight(BigDecimal.ZERO);

				orderVo.getOrderItems().forEach(item -> item.getEarnestPrice());

				productTotalPay = orderVo
						.getOrderItems()
						.stream()
						.map(item -> item.getEarnestPrice().multiply(
								new BigDecimal(item.getProductNum())))
						.reduce(BigDecimal.ZERO, BigDecimal::add)
						.add(productTotalPay);;

			}

			BigDecimal ymtCoupon = productTotalPay
					.add(freight)
					.subtract(sellerCoupon)
					.subtract(
							new BigDecimal(0.01, MathContext.DECIMAL32)
									.setScale(2));

			placeorderBean.getYmatouCoupon().setCouponValue(ymtCoupon);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.ERROR400,
					placeorderCall.getString("code"), "验证Code");

			Logger.verifyEquals("100", placeorderCall.getString("bcode"),
					"验证Code");
			Logger.verifyEquals("待分摊金额过大，无法按分摊比例及最大值限制分摊",
					placeorderCall.getString("msg"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_044() {
		Logger.start(true, "创建多个带运费的商品,校验订单上运费的汇总逻辑");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			placeorderBean
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.addAll(Arrays.asList(
							PlaceOrderService.getDefaultOrderItemVo(),
							PlaceOrderService.getDefaultOrderItemVo()));

			placeorderBean
					.getOrderGroups()
					.get(0)
					.getOrders()
					.addAll(Arrays.asList(
							PlaceOrderService.getDefaultOrderVo(null),
							PlaceOrderService.getDefaultOrderVo(null)));

			BigDecimal productTotalPay = BigDecimal.ZERO;

			for (OrderItemVo orderItemVo : placeorderBean.getOrderGroups()
					.get(0).getOrders().get(0).getOrderItems()) {

				orderItemVo
						.setFreight(new BigDecimal(new Random().nextInt(100)));

			}

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();
			// Thread.sleep(3000);
			verifyBaseInfo();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//砍价团点订单,还是由前端应用服务扣库存
	public void Tc_PlaceOrder_045() {
		Logger.start(true, "砍价团订单,无需交易扣库存,下单成功");
		try {

			JSONObject pro = creaderPro(100);

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			// 创建砍价团订单
			BizVo bizVo = new BizVo();
			// 砍价团id
			String bizId = TestDataManager.getRandomNum(5);
			// 1:砍价团
			int bizType = 1;
			// 砍价团(1 开团, 2 参团)
			Integer bizSubType = 1;

			bizVo.setBizId(bizId);
			bizVo.setBizType(bizType);
			bizVo.setBizSubType(bizSubType);

			placeorderBean.setBizSource(bizVo);

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(pro.getString("ProductId"));

			OrderItemVo.setCatalogId(pro.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.setNeedsReduceStock(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();

			verifyBaseInfo();

			int tradingid = placeorderCall.getTradingId();

			Map map = new HashMap();

			map.put("tradingid", tradingid);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyIsNull(tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");
			Logger.verifyIsNull(tradingReqPo.getStockInfoFile(),
					"验证ymt_tradingreq stockInfo");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_046() {
		Logger.start(true, "普通商品下单,无需交易扣库存,下单成功");
		try {

			JSONObject pro = creaderPro(100);

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(pro.getString("ProductId"));

			OrderItemVo.setCatalogId(pro.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.setNeedsReduceStock(false);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();

			verifyBaseInfo();

			int tradingid = placeorderCall.getTradingId();

			Map map = new HashMap();

			map.put("tradingid", tradingid);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyIsNull(tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");
			Logger.verifyIsNull(tradingReqPo.getStockInfoFile(),
					"验证ymt_tradingreq stockInfo");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_047() {
		Logger.start(true, "普通商品下单,扣库存成功,下单成功，无需发送返库存消息");
		try {

			JSONObject pro = creaderPro(100);

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(pro.getString("ProductId"));

			OrderItemVo.setCatalogId(pro.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.setNeedsReduceStock(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();

			verifyBaseInfo();

			int tradingid = placeorderCall.getTradingId();

			Map map = new HashMap();

			map.put("tradingid", tradingid);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(2, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_048() {
		Logger.start(true, "普通商品下单,库存不够导致扣库存失败,下单失败,不发送返库存消息");
		try {

			JSONObject pro = creaderPro(1);

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(pro.getString("ProductId"));

			OrderItemVo.setCatalogId(pro.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.setNeedsReduceStock(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(1, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//需要手工把库存服务停掉，模拟库存服务返回位置异常
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_049() {
		Logger.start(true, "普通商品下单,扣库存返回未知异常,下单失败,发送返库存消息");
		try {

			JSONObject pro = creaderPro(1);

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(pro.getString("ProductId"));

			OrderItemVo.setCatalogId(pro.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.setNeedsReduceStock(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);
			//3 已发送返库存
			Logger.verifyEquals(3, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//需要模拟库存服务返回超时
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_050() {
		Logger.start(true, "普通商品下单,扣库存返回超时,下单失败,发送返库存消息");
		try {

			JSONObject pro = creaderPro(1);

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(pro.getString("ProductId"));

			OrderItemVo.setCatalogId(pro.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.setNeedsReduceStock(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);
			//3 已发送返库存
			Logger.verifyEquals(3, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_051() {
		Logger.start(true, "普通商品下单,订单多个商品,部分商品扣库存失败,下单失败,不发送返库存消息");
		try {

			JSONObject pro = creaderPro(1);

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(pro.getString("ProductId"));

			OrderItemVo.setCatalogId(pro.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			OrderItemVo.setProductNum(2);

			JSONObject pro2 = creaderPro(100);
			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			OrderItemVo2.setProductId(pro2.getString("ProductId"));

			OrderItemVo2.setCatalogId(pro2.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			placeorderBean.setNeedsReduceStock(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Logger.info("reqid:" + reqId);

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(1, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_052() {
		Logger.start(true, "参加活动商品下单,扣库存成功,下单成功,不发送返库存消息");
		try {

			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(productAllPriceBean.getProductId());

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			OrderItemVo.setCatalogId(catalogAllPriceBean.getCatalogId());

			OrderItemVo.setProductNum(2);

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			placeorderBean.setNeedsReduceStock(true);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			Logger.info("reqid:" + placeorderBean.getRequestId());

			// 数据库验证
			//verifyDb();

			verifyBaseInfo();

			int tradingid = placeorderCall.getTradingId();

			Map map = new HashMap();

			map.put("tradingid", tradingid);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(2, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_053() {
		Logger.start(true, "参加活动商品下单,库存不够导致扣库存失败,下单失败,不发送返库存消息");
		try {

			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(productAllPriceBean.getProductId());

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			OrderItemVo.setCatalogId(catalogAllPriceBean.getCatalogId());

			OrderItemVo.setProductNum(catalogAllPriceBean.getiNum() + 1);

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			placeorderBean.setNeedsReduceStock(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Logger.info("reqid:" + reqId);

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(1, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//凡是MQ消息的，都手工去后台or 日志去看看 手工停掉服务
	public void Tc_PlaceOrder_054() {
		Logger.start(true, "参加活动商品下单,扣库存返回未知异常,下单失败,发送返库存消息");
		try {

			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(productAllPriceBean.getProductId());

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			OrderItemVo.setCatalogId(catalogAllPriceBean.getCatalogId());

			Logger.info("ProductId:" + productAllPriceBean.getProductId());
			Logger.info("catalogid:" + catalogAllPriceBean.getCatalogId());

			Logger.info("初始活动库存数量为:" + catalogAllPriceBean.getiNum());

			OrderItemVo.setProductNum(10);

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			placeorderBean.setNeedsReduceStock(true);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Logger.info("reqid:" + reqId);

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(3, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_055() {
		Logger.start(true, "订单里有活动商品和非活动商品,扣库存成功,下单成功,无需发送返库存消息");
		try {

			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(productAllPriceBean.getProductId());

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			OrderItemVo.setCatalogId(catalogAllPriceBean.getCatalogId());

			OrderItemVo.setProductNum(2);

			Logger.info("ProductId:" + productAllPriceBean.getProductId());
			Logger.info("catalogid:" + catalogAllPriceBean.getCatalogId());

			Logger.info("初始活动库存数量为:" + catalogAllPriceBean.getiNum());

			JSONObject pro2 = creaderPro(100);

			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			OrderItemVo2.setProductId(pro2.getString("ProductId"));

			Logger.info("普通商品 ProductId:" + OrderItemVo2.getProductId());

			OrderItemVo2.setCatalogId(pro2.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			placeorderBean.setNeedsReduceStock(true);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			Logger.info("reqid:" + placeorderBean.getRequestId());

			// 数据库验证
			//verifyDb();

			verifyBaseInfo();

			int tradingid = placeorderCall.getTradingId();

			Map map = new HashMap();

			map.put("tradingid", tradingid);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(2, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_056() {
		Logger.start(true, "订单里有活动商品和非活动商品,非活动商品库存不够导致扣库存失败,下单失败,无需发送返库存消息");
		try {

			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(productAllPriceBean.getProductId());

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			OrderItemVo.setCatalogId(catalogAllPriceBean.getCatalogId());

			OrderItemVo.setProductNum(2);

			Logger.info("ProductId:" + productAllPriceBean.getProductId());
			Logger.info("catalogid:" + catalogAllPriceBean.getCatalogId());

			Logger.info("初始活动库存数量为:" + catalogAllPriceBean.getiNum());

			JSONObject pro2 = creaderPro(1);

			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			OrderItemVo2.setProductId(pro2.getString("ProductId"));
			OrderItemVo2.setProductNum(2);

			Logger.info("普通商品 ProductId:" + OrderItemVo2.getProductId());

			OrderItemVo2.setCatalogId(pro2.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			placeorderBean.setNeedsReduceStock(true);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Logger.info("reqid:" + reqId);

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(1, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看
	public void Tc_PlaceOrder_057() {
		Logger.start(true, "订单里有活动商品和非活动商品,活动商品库存不够导致扣库存失败,下单失败,无需发送返库存消息");
		try {

			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(productAllPriceBean.getProductId());

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			OrderItemVo.setCatalogId(catalogAllPriceBean.getCatalogId());

			OrderItemVo.setProductNum(6);

			Logger.info("ProductId:" + productAllPriceBean.getProductId());
			Logger.info("catalogid:" + catalogAllPriceBean.getCatalogId());

			Logger.info("初始活动库存数量为:" + catalogAllPriceBean.getiNum());

			JSONObject pro2 = creaderPro(10);

			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			OrderItemVo2.setProductId(pro2.getString("ProductId"));
			OrderItemVo2.setProductNum(2);

			Logger.info("普通商品 ProductId:" + OrderItemVo2.getProductId());

			OrderItemVo2.setCatalogId(pro2.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			placeorderBean.setNeedsReduceStock(true);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Logger.info("reqid:" + reqId);

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(1, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//凡是MQ消息的，都手工去后台or 日志去看看 手工停掉库存服务，模拟未知异常
	public void Tc_PlaceOrder_058() {
		Logger.start(true, "订单里有活动商品和非活动商品,扣库存返回未知异常,下单失败，发送返库存消息");
		try {

			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setProductId(productAllPriceBean.getProductId());

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			OrderItemVo.setCatalogId(catalogAllPriceBean.getCatalogId());

			OrderItemVo.setProductNum(6);

			Logger.info("ProductId:" + productAllPriceBean.getProductId());
			Logger.info("catalogid:" + catalogAllPriceBean.getCatalogId());

			Logger.info("初始活动库存数量为:" + catalogAllPriceBean.getiNum());

			JSONObject pro2 = creaderPro(10);

			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			OrderItemVo2.setProductId(pro2.getString("ProductId"));
			OrderItemVo2.setProductNum(2);

			Logger.info("普通商品 ProductId:" + OrderItemVo2.getProductId());

			OrderItemVo2.setCatalogId(pro2.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId"));

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			placeorderBean.setNeedsReduceStock(true);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Logger.info("reqid:" + reqId);

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(3, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	//凡是MQ消息的，都手工去后台or 日志去看看 手工停掉库存服务，
	public void Tc_PlaceOrder_059() {
		Logger.start(true, "模拟库存扣减成功,下单失败(eg.不存在的优惠券导致下单失败)，校验库存已返回");
		try {

			//创建活动商品
			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			String activerProId = productAllPriceBean.getProductId();

			OrderItemVo.setProductId(activerProId);

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			String activerCatalogId = catalogAllPriceBean.getCatalogId();

			int activerStockNum = getStockNum(activerProId, activerCatalogId,
					true);

			OrderItemVo.setCatalogId(activerCatalogId);

			OrderItemVo.setProductNum(2);

			Logger.info("活动 ProductId:" + activerProId);
			Logger.info("活动 catalogid:" + activerCatalogId);

			JSONObject pro2 = creaderPro(10);

			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			String proId = pro2.getString("ProductId");

			OrderItemVo2.setProductId(proId);
			OrderItemVo2.setProductNum(5);

			Logger.info("普通商品 ProductId:" + OrderItemVo2.getProductId());

			String catalogId = pro2.getJSONArray("CatalogList")
					.getJSONObject(0).getString("CatalogId");

			Logger.info("普通商品 catalogId:" + catalogId);

			OrderItemVo2.setCatalogId(catalogId);

			int stockNum = getStockNum(proId, catalogId, false);

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			//设置不存在的买手优惠券 ，模拟扣库存成功，下单失败
			placeorderBean.getOrderGroups().get(0).getSellerCoupon()
					.setCouponCode("aaaaaaaaaabb");

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			placeorderBean.setNeedsReduceStock(true);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("112", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("此优惠券无效", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Logger.info("reqid:" + reqId);

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(3, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

			Thread.sleep(5000);

			Logger.verifyEquals(activerStockNum,
					getStockNum(activerProId, activerCatalogId, true),
					"交易扣库存成功，下单失败后，活动商品库存返还");

			Logger.verifyEquals(stockNum, getStockNum(proId, catalogId, false),
					"交易扣库存成功，下单失败后，商品库存返还");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//修改  saveactivitycalltpl.json     "BuyerJoinLimitNum": 3, 创建活动商品时，加上限购
	//凡是MQ消息的，都手工去后台or 日志去看看 手工停掉库存服务，
	public void Tc_PlaceOrder_060() {
		Logger.start(true, "活动商品超过购买限制，下单失败，不发送返库存消息");
		try {

			//创建活动商品
			ProductAllPriceBean productAllPriceBean = createActiverPro();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			String activerProId = productAllPriceBean.getProductId();

			OrderItemVo.setProductId(activerProId);

			CatalogAllPriceBean catalogAllPriceBean = productAllPriceBean
					.getCatalogAllPriceBeans().get(0);

			String activerCatalogId = catalogAllPriceBean.getCatalogId();

			int activerStockNum = getStockNum(activerProId, activerCatalogId,
					true);

			OrderItemVo.setCatalogId(activerCatalogId);

			OrderItemVo.setProductNum(4);

			Logger.info("ProductId:" + activerProId);
			Logger.info("catalogid:" + activerCatalogId);

			ActivityVo activity = new ActivityVo();

			activity.setActivityId(catalogAllPriceBean.getActivityId());

			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);

			OrderItemVo.setActivity(activity);

			OrderItemVo.setStockActivityLimitNumber(3);

			placeorderBean.setNeedsReduceStock(true);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

			Logger.verifyEquals("105", placeorderCall.getString("bcode"),
					"验证bcode");

			Logger.verifyEquals("扣库存失败.", placeorderCall.getString("msg"),
					"验证msg");

			String reqId = placeorderBean.getRequestId();

			Logger.info("reqid:" + reqId);

			Map map = new HashMap();

			map.put("reqId", reqId);

			TradingReqPo tradingReqPo = database.getTradingReq(map);

			Logger.verifyEquals(1, tradingReqPo.getStockStatus(),
					"验证ymt_tradingreq stockStatus");

			verifyStockStatus(tradingReqPo.getStockInfoFile());

			Thread.sleep(3000);

			Logger.verifyEquals(activerStockNum,
					getStockNum(activerProId, activerCatalogId, true),
					"交易扣库存成功，下单失败后，活动商品不变");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_061() {
		Logger.start(true, "一个订单里含有一个组合商品");
		try {

			SubcatalogsPo subcatalogsPo = new YmtProductsIWapper()
					.getSubcatalogs();

			//组合商品
			String catalogId = subcatalogsPo.getCatalogId();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setCatalogId(catalogId);

			OrderItemVo.setSubProduct(true);

			//placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			verifyDb();

			verifyPackageInfo();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_062() {
		Logger.start(true, "一个订单里包含多个组合商品");
		try {

			SubcatalogsPo subcatalogsPo = new YmtProductsIWapper()
					.getSubcatalogs();

			SubcatalogsPo subcatalogsPo2 = new YmtProductsIWapper()
					.getSubcatalogs();

			//组合商品
			String catalogId = subcatalogsPo.getCatalogId();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setCatalogId(catalogId);

			OrderItemVo.setSubProduct(true);

			OrderItemVo.setFreight(new BigDecimal(new Random().nextInt(100)));

			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			OrderItemVo2.setCatalogId(subcatalogsPo2.getCatalogId());

			OrderItemVo2.setFreight(new BigDecimal(new Random().nextInt(100)));

			OrderItemVo2.setSubProduct(true);

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			//placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			verifyDb();

			verifyPackageInfo();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_063() {
		Logger.start(true, "订单里有普通商品和组合商品");
		try {

			SubcatalogsPo subcatalogsPo = new YmtProductsIWapper()
					.getSubcatalogs();

			//组合商品
			String catalogId = subcatalogsPo.getCatalogId();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setCatalogId(catalogId);

			OrderItemVo.setSubProduct(true);

			OrderItemVo.setFreight(new BigDecimal(new Random().nextInt(100)));

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();
			sellerPromotion1.setAmountCondition(new BigDecimal(20));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");
			Set<String> productList = new HashSet<String>();
			productList.add(OrderItemVo.getProductId());
			sellerPromotion1.setProductIds(productList);
			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);
			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.DiscountIfCountEnough);

			sellerPromotionList.add(sellerPromotion1);

			placeorderBean.getOrderGroups().get(0)
					.setSellerPromotions(sellerPromotionList);

			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			OrderItemVo2.setFreight(new BigDecimal(new Random().nextInt(100)));

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			verifyDb();

			verifyPackageInfo();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_064() {
		Logger.start(true, "下单服务传过来是组合商品,交易在商品服务查不到组合商品明细");
		try {

			/*			SubcatalogsPo subcatalogsPo = new YmtProductsIWapper()
								.getSubcatalogs();

						//组合商品
						String catalogId = subcatalogsPo.getCatalogId();*/

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setSubProduct(true);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			verifyDb();

			//verifyPackageInfo();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_065() {
		Logger.start(true, "下一单含有30个商品");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			for (int i = 0; i < 30; i++) {
				placeorderBean.getOrderGroups().get(0).getOrders().get(0)
						.getOrderItems()
						.add(PlaceOrderService.getDefaultOrderItemVo());
			}

			placeorderBean.setNeedsReduceStock(true);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.FAILED201,
					placeorderCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_066() {
		Logger.start(true, "订单为电商件,物流为贝海直邮");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setEcommerceFlag(true);

			OrderItemVo.setLogisticsType(LogisticsTypeEnum.SailProtect);

			placeorderBean.setNeedsReduceStock(false);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			// 数据库验证
			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_067() {
		Logger.start(true, "订单为电商件,物流为非贝海直邮");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setEcommerceFlag(true);

			OrderItemVo.setLogisticsType(LogisticsTypeEnum.PackageDelivery);

			placeorderBean.setNeedsReduceStock(false);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			// 数据库验证
			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_068() {
		Logger.start(true, "一次交易2个订单,一个订单为贝海直邮个人件,另一个为贝海保税,收件人已经上传身份证");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			int userId = placeorderBean.getUserId();

			//第一个订单 个人件
			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setLogisticsType(LogisticsTypeEnum.SailProtect);

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setEcommerceFlag(false);

			//第二个订单 贝海保税
			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			orderVo2.setEcommerceFlag(true);

			orderVo2.getOrderItems().get(0)
					.setLogisticsType(LogisticsTypeEnum.SailProtect);

			placeorderBean.getOrderGroups().get(0).getOrders().add(orderVo2);

			placeorderBean.setNeedsReduceStock(false);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			// 数据库验证
			verifyDb();

			Thread.sleep(2000);

			int orderId1 = placeorderCall.getOrderIds().getInt(0);
			int orderId2 = placeorderCall.getOrderIds().getInt(1);

			// 订单扩展表
			List<Map> ymtOrdersExt1 = database.selectOrderExtByOderId(orderId1);
			List<Map> ymtOrdersExt2 = database.selectOrderExtByOderId(orderId2);

			Logger.verifyEquals(true,
					ymtOrdersExt1.get(0).get("bHaveUploadedIdCard"), "验证身份证状态");

			Logger.verifyEquals(true,
					ymtOrdersExt2.get(0).get("bHaveUploadedIdCard"), "验证身份证状态");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_069() {
		Logger.start(true, "一次交易2个订单,一个订单为贝海直邮个人件,另一个为贝海保税,收件人没有上传身份证");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			int userId = placeorderBean.getUserId();

			String receiveName = TestDataManager.getChineseName();
			String phone = "139" + TestDataManager.getRandomIntNum(8);

			//第一个订单 个人件
			OrderVo orderVo1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0);

			OrderItemVo OrderItemVo1 = orderVo1.getOrderItems().get(0);

			OrderItemVo1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderVo1.setReceiveName(receiveName);
			orderVo1.setPhone(phone);

			//第二个订单 贝海保税
			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			orderVo2.setEcommerceFlag(true);

			orderVo2.setReceiveName(receiveName);
			orderVo2.setPhone(phone);

			orderVo2.getOrderItems().get(0)
					.setLogisticsType(LogisticsTypeEnum.SailProtect);

			placeorderBean.getOrderGroups().get(0).getOrders().add(orderVo2);

			placeorderBean.setNeedsReduceStock(false);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			// 数据库验证
			verifyDb();

			Thread.sleep(2000);
			int orderId1 = placeorderCall.getOrderIds().getInt(0);
			int orderId2 = placeorderCall.getOrderIds().getInt(1);

			// 订单扩展表
			List<Map> ymtOrdersExt1 = database.selectOrderExtByOderId(orderId1);
			List<Map> ymtOrdersExt2 = database.selectOrderExtByOderId(orderId2);

			Logger.verifyEquals(false,
					ymtOrdersExt1.get(0).get("bHaveUploadedIdCard"), "验证身份证状态");

			Logger.verifyEquals(false,
					ymtOrdersExt2.get(0).get("bHaveUploadedIdCard"), "验证身份证状态");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//修改update Ymt_IdCardInfo set haspic=0 where BuyerId = 20238699 and name='张三'
	public void Tc_PlaceOrder_070() {
		Logger.start(true, "一次交易2个订单,一个订单为贝海直邮个人件,另一个为贝海保税,收件人有身份证信息但没有身份证图片");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			int userId = placeorderBean.getUserId();

			String receiveName = "张三";
			String phone = "13673201578";

			//第一个订单 个人件
			OrderVo orderVo1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0);

			OrderItemVo OrderItemVo1 = orderVo1.getOrderItems().get(0);

			OrderItemVo1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderVo1.setReceiveName(receiveName);
			orderVo1.setPhone(phone);

			//第二个订单 贝海保税
			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			orderVo2.setEcommerceFlag(true);

			orderVo2.setReceiveName(receiveName);
			orderVo2.setPhone(phone);

			orderVo2.getOrderItems().get(0)
					.setLogisticsType(LogisticsTypeEnum.SailProtect);

			placeorderBean.getOrderGroups().get(0).getOrders().add(orderVo2);

			placeorderBean.setNeedsReduceStock(false);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			// 数据库验证
			verifyDb();

			Thread.sleep(2000);
			int orderId1 = placeorderCall.getOrderIds().getInt(0);
			int orderId2 = placeorderCall.getOrderIds().getInt(1);

			// 订单扩展表
			List<Map> ymtOrdersExt1 = database.selectOrderExtByOderId(orderId1);
			List<Map> ymtOrdersExt2 = database.selectOrderExtByOderId(orderId2);

			Logger.verifyEquals(false,
					ymtOrdersExt1.get(0).get("bHaveUploadedIdCard"), "验证身份证状态");

			Logger.verifyEquals(true,
					ymtOrdersExt2.get(0).get("bHaveUploadedIdCard"), "验证身份证状态");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//update Ymt_IdCardInfo set Status=-1 where BuyerId = 20238699 and name='张三'
	public void Tc_PlaceOrder_071() {
		Logger.start(true, "一次交易2个订单,一个订单为贝海直邮个人件,另一个为贝海保税,收件人有身份证信息为未审核通过状态");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			int userId = placeorderBean.getUserId();

			String receiveName = "张三";
			String phone = "13673201578";

			//第一个订单 个人件
			OrderVo orderVo1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0);

			OrderItemVo OrderItemVo1 = orderVo1.getOrderItems().get(0);

			OrderItemVo1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderVo1.setReceiveName(receiveName);
			orderVo1.setPhone(phone);

			//第二个订单 贝海保税
			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			orderVo2.setEcommerceFlag(true);

			orderVo2.setReceiveName(receiveName);
			orderVo2.setPhone(phone);

			orderVo2.getOrderItems().get(0)
					.setLogisticsType(LogisticsTypeEnum.SailProtect);

			placeorderBean.getOrderGroups().get(0).getOrders().add(orderVo2);

			placeorderBean.setNeedsReduceStock(false);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			// 数据库验证
			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//update Ymt_IdCardInfo set Status=-1 where BuyerId = 20238699 and name='张三'
	public void Tc_PlaceOrder_072() {
		Logger.start(true, "一次交易2个订单,一个订单为贝海直邮个人件,另一个为贝海保税,本地库没有查询贝海身份证信息");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			int userId = placeorderBean.getUserId();

			String receiveName = "张蒙";
			String phone = "13808338330";

			//第一个订单 个人件
			OrderVo orderVo1 = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0);

			OrderItemVo OrderItemVo1 = orderVo1.getOrderItems().get(0);

			OrderItemVo1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderVo1.setReceiveName(receiveName);
			orderVo1.setPhone(phone);

			//第二个订单 贝海保税
			OrderVo orderVo2 = PlaceOrderService.getDefaultOrderVo(userId);

			orderVo2.setEcommerceFlag(true);

			orderVo2.setReceiveName(receiveName);
			orderVo2.setPhone(phone);

			orderVo2.getOrderItems().get(0)
					.setLogisticsType(LogisticsTypeEnum.SailProtect);

			placeorderBean.getOrderGroups().get(0).getOrders().add(orderVo2);

			placeorderBean.setNeedsReduceStock(false);

			placeorderCall.setData(placeorderBean);

			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证code");

			// 数据库验证
			verifyDb();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_073() {
		Logger.start(true, "虚拟商品订单下单成功");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			BizVo bizVo = new BizVo();

			// 虚拟商品
			int bizType = BizTypeEnum.VIRTUAL_PRODUCT.getCode();

			String bizId = TestDataManager.getRandomNum(5);

			bizVo.setBizId(bizId);
			bizVo.setBizType(bizType);

			placeorderBean.setBizSource(bizVo);
			//物流方式
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0)
					.setLogisticsType(LogisticsTypeEnum.AutoDelivery);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();

			verifyBargainGroup();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_074() {
		Logger.start(true, "砍价团虚拟商品订单下单成功");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			BizVo bizVo = new BizVo();

			// 虚拟商品
			int bizType = BizTypeEnum.BARGAIN_GROUP_VIRTUAL_PRODUCT.getCode();

			String bizId = TestDataManager.getRandomNum(5);

			// 砍价团(1 开团, 2 参团)
			Integer bizSubType = 1;

			bizVo.setBizId(bizId);
			bizVo.setBizType(bizType);
			bizVo.setBizSubType(bizSubType);

			placeorderBean.setBizSource(bizVo);
			//物流方式
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0)
					.setLogisticsType(LogisticsTypeEnum.AutoDelivery);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();

			verifyBargainGroup();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_PlaceOrder_075() {
		Logger.start(true, "第三方保税商品订单也需要上传身份证");
		try {

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			//物流方式
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0)
					.setLogisticsType(LogisticsTypeEnum.BondedDelivery);

			placeorderCall.setData(placeorderBean);
			placeorderCall.callService();

			Logger.verifyEquals(ECode.SUCCESS,
					placeorderCall.getString("code"), "验证Code");

			// 数据库验证
			verifyDb();

			int orderId = placeorderCall.getOrderIds().getInt(0);

			DefaultWapper database = new DefaultWapper();

			Logger.verifyEquals(true, database.selectOrderExtByOderId(orderId)
					.get(0).get("bIsNeedUploadIdCard"), "第三方保税需要上传身份证信息");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}
